@dxos/app-framework 0.3.9-main.cea1d3b → 0.3.9-main.dd8d283
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{chunk-WDA7VA54.mjs → chunk-MNFAM2GF.mjs} +1 -1
- package/dist/lib/browser/{chunk-WDA7VA54.mjs.map → chunk-MNFAM2GF.mjs.map} +2 -2
- package/dist/lib/browser/index.mjs +33 -7
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{plugin-XEJ5RYCP.mjs → plugin-JDIMDLDU.mjs} +2 -2
- package/dist/lib/node/{chunk-YDKX45O3.cjs → chunk-DC3GU6QR.cjs} +4 -4
- package/dist/lib/node/chunk-DC3GU6QR.cjs.map +7 -0
- package/dist/lib/node/index.cjs +38 -13
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{plugin-RCAOZKNL.cjs → plugin-JGSJGRMS.cjs} +8 -8
- package/dist/types/src/plugins/SurfacePlugin/Surface.d.ts +2 -0
- package/dist/types/src/plugins/SurfacePlugin/Surface.d.ts.map +1 -1
- package/dist/types/src/plugins/SurfacePlugin/SurfaceRootContext.d.ts +10 -2
- package/dist/types/src/plugins/SurfacePlugin/SurfaceRootContext.d.ts.map +1 -1
- package/dist/types/src/plugins/SurfacePlugin/helpers.d.ts +21 -0
- package/dist/types/src/plugins/SurfacePlugin/helpers.d.ts.map +1 -0
- package/dist/types/src/plugins/SurfacePlugin/index.d.ts +1 -0
- package/dist/types/src/plugins/SurfacePlugin/index.d.ts.map +1 -1
- package/dist/types/src/plugins/common/graph.d.ts +2 -2
- package/dist/types/src/plugins/common/graph.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/plugins/SurfacePlugin/Surface.tsx +34 -5
- package/src/plugins/SurfacePlugin/SurfaceRootContext.tsx +15 -2
- package/src/plugins/SurfacePlugin/helpers.ts +22 -0
- package/src/plugins/SurfacePlugin/index.ts +1 -0
- package/src/plugins/common/graph.ts +2 -2
- package/dist/lib/node/chunk-YDKX45O3.cjs.map +0 -7
- /package/dist/lib/browser/{plugin-XEJ5RYCP.mjs.map → plugin-JDIMDLDU.mjs.map} +0 -0
- /package/dist/lib/node/{plugin-RCAOZKNL.cjs.map → plugin-JGSJGRMS.cjs.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/plugins/SurfacePlugin/provides.ts", "../../../src/plugins/SurfacePlugin/SurfaceRootContext.tsx", "../../../src/plugins/SurfacePlugin/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type SurfaceComponent, type SurfaceRootContext } from './SurfaceRootContext';\nimport { type Plugin } from '../PluginHost';\n\nexport type SurfaceProvides = {\n surface: {\n /**\n * Used by the `Surface` resolver to find a component to render.\n */\n component: SurfaceComponent;\n };\n};\n\nexport type SurfacePluginProvides = {\n surface: SurfaceRootContext;\n};\n\nexport const parseRootSurfacePlugin = (plugin?: Plugin) =>\n (plugin?.provides as any)?.surface?.components ? (plugin as Plugin<SurfacePluginProvides>) : undefined;\n\nexport const parseSurfacePlugin = (plugin?: Plugin) =>\n (plugin?.provides as any)?.surface?.component ? (plugin as Plugin<SurfaceProvides>) : undefined;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { createContext, useContext, type Context, type Provider, type
|
|
5
|
-
"mappings": ";AAoBO,IAAMA,yBAAyB,CAACC,WACpCA,QAAQC,UAAkBC,SAASC,aAAcH,SAA2CI;AAExF,IAAMC,qBAAqB,CAACL,WAChCA,QAAQC,UAAkBC,SAASI,YAAaN,SAAqCI;;;ACpBxF,SAASG,eAAeC,
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type SurfaceComponent, type SurfaceRootContext } from './SurfaceRootContext';\nimport { type Plugin } from '../PluginHost';\n\nexport type SurfaceProvides = {\n surface: {\n /**\n * Used by the `Surface` resolver to find a component to render.\n */\n component: SurfaceComponent;\n };\n};\n\nexport type SurfacePluginProvides = {\n surface: SurfaceRootContext;\n};\n\nexport const parseRootSurfacePlugin = (plugin?: Plugin) =>\n (plugin?.provides as any)?.surface?.components ? (plugin as Plugin<SurfacePluginProvides>) : undefined;\n\nexport const parseSurfacePlugin = (plugin?: Plugin) =>\n (plugin?.provides as any)?.surface?.component ? (plugin as Plugin<SurfaceProvides>) : undefined;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { createContext, useContext, type Context, type Provider, type ForwardedRef } from 'react';\n\nimport { type SurfaceProps } from './Surface';\n\n// TODO(wittjosiah): Factor out.\ntype WithRequiredProperty<Type, Key extends keyof Type> = Type & {\n [Property in Key]-?: Type[Property];\n};\n\ntype SurfaceComponentProps = WithRequiredProperty<SurfaceProps, 'data'>;\n\n/**\n * Determines the priority of the surface when multiple components are resolved.\n */\nexport type SurfaceDisposition = 'hoist' | 'fallback';\n\nexport type SurfaceResult = {\n node: JSX.Element;\n disposition?: SurfaceDisposition;\n};\n\n/**\n * Function which resolves a Surface.\n *\n * If a null value is returned, the rendering is deferred to other plugins.\n */\nexport type SurfaceComponent = (\n props: SurfaceComponentProps,\n forwardedRef: ForwardedRef<HTMLElement>,\n) => JSX.Element | SurfaceResult | null;\n\nexport type SurfaceRootContext = {\n components: Record<string, SurfaceComponent>;\n};\n\nconst SurfaceRootContext: Context<SurfaceRootContext> = createContext<SurfaceRootContext>({ components: {} });\n\nexport const useSurface = () => useContext(SurfaceRootContext);\n\nexport const SurfaceProvider: Provider<SurfaceRootContext> = SurfaceRootContext.Provider;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nconst SurfaceMeta = {\n id: 'dxos.org/plugin/surface',\n};\n\nexport default SurfaceMeta;\n"],
|
|
5
|
+
"mappings": ";AAoBO,IAAMA,yBAAyB,CAACC,WACpCA,QAAQC,UAAkBC,SAASC,aAAcH,SAA2CI;AAExF,IAAMC,qBAAqB,CAACL,WAChCA,QAAQC,UAAkBC,SAASI,YAAaN,SAAqCI;;;ACpBxF,SAASG,eAAeC,kBAAkE;AAmC1F,IAAMC,qBAAkDC,8BAAkC;EAAEC,YAAY,CAAC;AAAE,CAAA;AAEpG,IAAMC,aAAa,MAAMC,WAAWJ,kBAAAA;AAEpC,IAAMK,kBAAgDL,mBAAmBM;;;ACvChF,IAAMC,cAAc;EAClBC,IAAI;AACN;AAEA,IAAA,eAAeD;",
|
|
6
6
|
"names": ["parseRootSurfacePlugin", "plugin", "provides", "surface", "components", "undefined", "parseSurfacePlugin", "component", "createContext", "useContext", "SurfaceRootContext", "createContext", "components", "useSurface", "useContext", "SurfaceProvider", "Provider", "SurfaceMeta", "id"]
|
|
7
7
|
}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
parseRootSurfacePlugin,
|
|
5
5
|
parseSurfacePlugin,
|
|
6
6
|
useSurface
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MNFAM2GF.mjs";
|
|
8
8
|
import {
|
|
9
9
|
IntentProvider,
|
|
10
10
|
meta_default,
|
|
@@ -242,6 +242,9 @@ var compose = (contexts) => {
|
|
|
242
242
|
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ React.createElement(Acc, null, /* @__PURE__ */ React.createElement(Next, null, children)));
|
|
243
243
|
};
|
|
244
244
|
|
|
245
|
+
// packages/sdk/app-framework/src/plugins/SurfacePlugin/helpers.ts
|
|
246
|
+
var isObject = (data) => !!data && typeof data === "object";
|
|
247
|
+
|
|
245
248
|
// packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx
|
|
246
249
|
import React2, { Component } from "react";
|
|
247
250
|
var ErrorBoundary = class extends Component {
|
|
@@ -278,7 +281,7 @@ var ErrorBoundary = class extends Component {
|
|
|
278
281
|
};
|
|
279
282
|
|
|
280
283
|
// packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx
|
|
281
|
-
import React3, { forwardRef, Fragment } from "react";
|
|
284
|
+
import React3, { forwardRef, Fragment, isValidElement } from "react";
|
|
282
285
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
283
286
|
var Surface = /* @__PURE__ */ forwardRef(({ role, name = role, fallback, ...rest }, forwardedRef) => {
|
|
284
287
|
const props = {
|
|
@@ -326,10 +329,32 @@ var resolveNodes = (components, props, context, forwardedRef) => {
|
|
|
326
329
|
...props,
|
|
327
330
|
data
|
|
328
331
|
}, forwardedRef);
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
}
|
|
332
|
-
|
|
332
|
+
if (!result || typeof result !== "object") {
|
|
333
|
+
return void 0;
|
|
334
|
+
}
|
|
335
|
+
return "node" in result ? [
|
|
336
|
+
key,
|
|
337
|
+
result
|
|
338
|
+
] : /* @__PURE__ */ isValidElement(result) ? [
|
|
339
|
+
key,
|
|
340
|
+
{
|
|
341
|
+
node: result
|
|
342
|
+
}
|
|
343
|
+
] : void 0;
|
|
344
|
+
}).filter((result) => Boolean(result)).sort(([, a], [, b]) => {
|
|
345
|
+
const aDisposition = a.disposition ?? "default";
|
|
346
|
+
const bDisposition = b.disposition ?? "default";
|
|
347
|
+
if (aDisposition === bDisposition) {
|
|
348
|
+
return 0;
|
|
349
|
+
} else if (aDisposition === "hoist" || bDisposition === "fallback") {
|
|
350
|
+
return -1;
|
|
351
|
+
} else if (bDisposition === "hoist" || aDisposition === "fallback") {
|
|
352
|
+
return 1;
|
|
353
|
+
}
|
|
354
|
+
return 0;
|
|
355
|
+
}).map(([key, result]) => /* @__PURE__ */ React3.createElement(Fragment, {
|
|
356
|
+
key
|
|
357
|
+
}, result.node));
|
|
333
358
|
return props.limit ? nodes.slice(0, props.limit) : nodes;
|
|
334
359
|
};
|
|
335
360
|
|
|
@@ -346,7 +371,7 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
346
371
|
],
|
|
347
372
|
plugins: {
|
|
348
373
|
...plugins,
|
|
349
|
-
[meta_default2.id]: Plugin.lazy(() => import("./plugin-
|
|
374
|
+
[meta_default2.id]: Plugin.lazy(() => import("./plugin-JDIMDLDU.mjs")),
|
|
350
375
|
[meta_default.id]: Plugin.lazy(() => import("./plugin-CBPJO5NB.mjs"))
|
|
351
376
|
},
|
|
352
377
|
core: [
|
|
@@ -396,6 +421,7 @@ export {
|
|
|
396
421
|
findPlugin,
|
|
397
422
|
getPlugin,
|
|
398
423
|
initializePlugin,
|
|
424
|
+
isObject,
|
|
399
425
|
parseGraphBuilderPlugin,
|
|
400
426
|
parseGraphPlugin,
|
|
401
427
|
parseIntentPlugin,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugins/common/graph.ts", "../../../src/plugins/common/layout.ts", "../../../src/plugins/common/metadata.ts", "../../../src/plugins/common/translations.ts", "../../../src/plugins/PluginHost/plugin.ts", "../../../src/plugins/PluginHost/PluginContext.tsx", "../../../src/plugins/PluginHost/PluginHost.tsx", "../../../src/plugins/SurfacePlugin/ErrorBoundary.tsx", "../../../src/plugins/SurfacePlugin/Surface.tsx", "../../../src/App.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Graph, Node } from '@dxos/app-graph';\nimport type { UnsubscribeCallback } from '@dxos/async';\n\nimport type { Plugin } from '../PluginHost';\n\n/**\n * Provides for a plugin that exposes the application graph.\n */\nexport type GraphPluginProvides = {\n graph: Graph;\n};\n\nexport type GraphBuilderProvides = {\n graph: {\n builder: (params: { parent: Node; plugins: Plugin[] }) => UnsubscribeCallback | void;\n };\n};\n\n/**\n * Type guard for graph plugins.\n */\nexport const parseGraphPlugin = (plugin: Plugin) =>\n (plugin.provides as any).graph?.root ? (plugin as Plugin<GraphPluginProvides>) : undefined;\n\n/**\n * Type guard for graph builder plugins.\n */\nexport const parseGraphBuilderPlugin = (plugin: Plugin) =>\n (plugin.provides as any).graph?.builder ? (plugin as Plugin<GraphBuilderProvides>) : undefined;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { z } from 'zod';\n\nimport type { Plugin } from '../PluginHost';\n\n//\n// Provides\n//\n\n/**\n * Basic state provided by a layout plugin.\n */\nexport const Layout = z.object({\n fullscreen: z.boolean(),\n sidebarOpen: z.boolean(),\n complementarySidebarOpen: z.boolean(),\n\n dialogContent: z.any().optional().describe('Data to be passed to the dialog Surface.'),\n dialogOpen: z.boolean(),\n\n popoverAnchorId: z.string().optional(),\n popoverContent: z.any().optional().describe('Data to be passed to the popover Surface.'),\n popoverOpen: z.boolean(),\n\n // TODO(wittjosiah): Array?\n active: z.string().optional().describe('Id of the currently active item.'),\n // TODO(wittjosiah): History?\n previous: z.string().optional(),\n});\n\nexport type Layout = z.infer<typeof Layout>;\n\n/**\n * Provides for a plugin that can manage the app layout.\n */\nexport type LayoutProvides = {\n layout: Readonly<Layout>;\n};\n\n/**\n * Type guard for layout plugins.\n */\nexport const parseLayoutPlugin = (plugin: Plugin) => {\n const { success } = Layout.safeParse((plugin.provides as any).layout);\n return success ? (plugin as Plugin<LayoutProvides>) : undefined;\n};\n\n//\n// Intents\n//\n\nconst LAYOUT_ACTION = 'dxos.org/plugin/intent';\n// TODO(wittjosiah): Consider consolidating some action types (e.g. toggle).\nexport enum LayoutAction {\n TOGGLE_FULLSCREEN = `${LAYOUT_ACTION}/toggle-fullscreen`,\n TOGGLE_SIDEBAR = `${LAYOUT_ACTION}/toggle-sidebar`,\n TOGGLE_COMPLEMENTARY_SIDEBAR = `${LAYOUT_ACTION}/toggle-complementary-sidebar`,\n OPEN_DIALOG = `${LAYOUT_ACTION}/open-dialog`,\n CLOSE_DIALOG = `${LAYOUT_ACTION}/close-dialog`,\n OPEN_POPOVER = `${LAYOUT_ACTION}/open-popover`,\n CLOSE_POPOVER = `${LAYOUT_ACTION}/close-popover`,\n ACTIVATE = `${LAYOUT_ACTION}/activate`,\n}\n\n/**\n * Expected payload for layout actions.\n */\nexport namespace LayoutAction {\n export type ToggleFullscreen = {\n state?: boolean;\n };\n\n export type ToggleSidebar = {\n state?: boolean;\n };\n\n export type ToggleComplementarySidebar = {\n state?: boolean;\n };\n\n export type OpenDialog = {\n component: string;\n subject: any;\n };\n\n export type CloseDialog = {};\n\n export type OpenPopover = {\n anchorId: string;\n component: string;\n subject: any;\n };\n\n export type ClosePopover = {};\n\n export type Activate = {\n id: string;\n };\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Plugin } from '../PluginHost';\n\nexport type Metadata = Record<string, any>;\n\nexport type MetadataRecordsProvides = {\n metadata: {\n records: Record<string, Metadata>;\n };\n};\n\nexport type MetadataResolver = (type: string) => Metadata;\n\nexport type MetadataResolverProvides = {\n metadata: {\n resolver: MetadataResolver;\n };\n};\n\nexport const parseMetadataRecordsPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).metadata?.records ? (plugin as Plugin<MetadataRecordsProvides>) : undefined;\n};\n\nexport const parseMetadataResolverPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).metadata?.resolver ? (plugin as Plugin<MetadataResolverProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { z } from 'zod';\n\nimport type { Plugin } from '../PluginHost';\n\nexport const ResourceKey = z.union([z.string(), z.record(z.any())]);\nexport type ResourceKey = z.infer<typeof ResourceKey>;\n\nexport const ResourceLanguage = z.record(ResourceKey);\nexport type ResourceLanguage = z.infer<typeof ResourceLanguage>;\n\n/**\n * A resource is a collection of translations for a language.\n */\nexport const Resource = z.record(ResourceLanguage);\nexport type Resource = z.infer<typeof Resource>;\n\n/**\n * Provides for a plugin that exposes translations.\n */\n// TODO(wittjosiah): Rename to TranslationResourcesProvides.\nexport type TranslationsProvides = {\n translations: Readonly<Resource[]>;\n};\n\n// TODO(wittjosiah): Add TranslationsProvides.\n// export type TranslationsProvides = {\n// translations: {\n// t: TFunction;\n// };\n// };\n\n/**\n * Type guard for translation plugins.\n */\nexport const parseTranslationsPlugin = (plugin: Plugin) => {\n const { success } = z.array(Resource).safeParse((plugin.provides as any).translations);\n return success ? (plugin as Plugin<TranslationsProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { IconProps } from '@phosphor-icons/react';\nimport type { FC, PropsWithChildren } from 'react';\n\n/**\n * Capabilities provided by a plugin.\n * The base surface capabilities are always included.\n */\nexport type PluginProvides<TProvides> = TProvides & {\n /**\n * React Context which is wrapped around the application to enable any hooks the plugin may provide.\n */\n context?: FC<PropsWithChildren>;\n\n /*\n * React component which is rendered at the root of the application.\n */\n root?: FC<PropsWithChildren>;\n};\n\n/**\n * A unit of containment of modular functionality that can be provided to an application.\n * Plugins provide things like components, state, actions, etc. to the application.\n */\nexport type Plugin<TProvides = {}> = {\n meta: {\n /**\n * Globally unique ID.\n *\n * Expected to be in the form of a valid URL.\n *\n * @example dxos.org/plugin/example\n */\n id: string;\n\n /**\n * Short ID for use in URLs.\n *\n * NOTE: This is especially experimental and likely to change.\n */\n // TODO(wittjosiah): How should these be managed?\n shortId?: string;\n\n /**\n * Human readable name.\n */\n name?: string;\n\n /**\n * Short description of plugin functionality.\n */\n description?: string;\n\n /**\n * Component to render icon for the plugin when displayed in a list.\n */\n // TODO(wittjosiah): Convert to `icon` and make serializable.\n iconComponent?: FC<IconProps>;\n };\n\n /**\n * Capabilities provided by the plugin.\n */\n provides: PluginProvides<TProvides>;\n};\n\n/**\n * Plugin definitions extend the base `Plugin` interface with additional lifecycle methods.\n */\nexport type PluginDefinition<TProvides = {}, TInitializeProvides = {}> = Omit<Plugin, 'provides'> & {\n /**\n * Capabilities provided by the plugin.\n */\n provides?: Plugin<TProvides>['provides'];\n\n /**\n * Initialize any async behavior required by the plugin.\n *\n * @return Capabilities provided by the plugin which are merged with base capabilities.\n */\n initialize?: () => Promise<PluginProvides<TInitializeProvides>>;\n\n /**\n * Called once all plugins have been initialized.\n * This is the place to do any initialization which requires other plugins to be ready.\n *\n * @param plugins All plugins which successfully initialized.\n */\n ready?: (plugins: Plugin[]) => Promise<void>;\n\n /**\n * Called when the plugin is unloaded.\n * This is the place to do any cleanup required by the plugin.\n */\n unload?: () => Promise<void>;\n};\n\nexport const pluginMeta = (meta: Plugin['meta']) => meta;\n\ntype LazyPlugin<T> = () => Promise<{ default: (props: T) => PluginDefinition }>;\n\nexport namespace Plugin {\n export const lazy = <T>(p: LazyPlugin<T>, props?: T) => {\n return () =>\n p().then(({ default: definition }) => {\n return definition(props as T);\n });\n };\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Context, type Provider, createContext, useContext } from 'react';\n\nimport { type Plugin } from './plugin';\nimport { findPlugin, resolvePlugin } from '../helpers';\n\nexport type PluginContext = {\n /**\n * All plugins are ready.\n */\n ready: boolean;\n\n /**\n * Ids of plugins which are enabled on this device.\n */\n enabled: string[];\n\n /**\n * Initialized and ready plugins.\n */\n plugins: Plugin[];\n\n /**\n * All available plugins.\n */\n available: Plugin['meta'][];\n\n /**\n * Mark plugin as enabled.\n *\n * Requires reload to take effect.\n */\n enablePlugin: (id: string) => void;\n\n /**\n * Mark plugin as disabled.\n *\n * Requires reload to take effect.\n */\n disablePlugin: (id: string) => void;\n};\n\nconst PluginContext: Context<PluginContext> = createContext<PluginContext>({\n ready: false,\n enabled: [],\n plugins: [],\n available: [],\n enablePlugin: () => {},\n disablePlugin: () => {},\n});\n\n/**\n * Get all plugins.\n */\nexport const usePlugins = (): PluginContext => useContext(PluginContext);\n\n/**\n * Get a plugin by ID.\n */\nexport const usePlugin = <T,>(id: string): Plugin<T> | undefined => {\n const { plugins } = usePlugins();\n return findPlugin<T>(plugins, id);\n};\n\n/**\n * Resolve a plugin by predicate.\n */\nexport const useResolvePlugin = <T,>(predicate: (plugin: Plugin) => Plugin<T> | undefined): Plugin<T> | undefined => {\n const { plugins } = usePlugins();\n return resolvePlugin(plugins, predicate);\n};\n\nexport const PluginProvider: Provider<PluginContext> = PluginContext.Provider;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { shallow } from 'deepsignal/react';\nimport React, { useEffect, type FC, type PropsWithChildren, type ReactNode } from 'react';\n\nimport { LocalStorageStore } from '@dxos/local-storage';\nimport { log } from '@dxos/log';\n\nimport { type PluginContext, PluginProvider } from './PluginContext';\nimport { type Plugin, type PluginDefinition, type PluginProvides } from './plugin';\n\nexport type BootstrapPluginsParams = {\n order: PluginDefinition['meta'][];\n plugins: Record<string, () => Promise<PluginDefinition>>;\n core?: string[];\n defaults?: string[];\n fallback?: ReactNode;\n};\n\nexport type PluginHostProvides = {\n plugins: PluginContext;\n};\n\nexport const parsePluginHost = (plugin: Plugin) =>\n (plugin.provides as PluginHostProvides).plugins ? (plugin as Plugin<PluginHostProvides>) : undefined;\n\nconst PLUGIN_HOST = 'dxos.org/plugin/host';\n\n/**\n * Bootstraps an application by initializing plugins and rendering root components.\n */\nexport const PluginHost = ({\n order,\n plugins: definitions,\n core = [],\n defaults = [],\n fallback = null,\n}: BootstrapPluginsParams): PluginDefinition<PluginHostProvides> => {\n const state = new LocalStorageStore<PluginContext>(PLUGIN_HOST, {\n ready: false,\n enabled: [...defaults],\n plugins: [],\n available: order.filter(({ id }) => !core.includes(id)),\n enablePlugin: (id: string) => {\n state.values.enabled = [...state.values.enabled, id];\n },\n disablePlugin: (id: string) => {\n state.values.enabled = state.values.enabled.filter((enabled) => enabled !== id);\n },\n });\n\n state.prop(state.values.$enabled!, 'enabled', LocalStorageStore.json);\n\n return {\n meta: {\n id: PLUGIN_HOST,\n name: 'Plugin host',\n },\n provides: {\n plugins: state.values,\n context: ({ children }) => <PluginProvider value={state.values}>{children}</PluginProvider>,\n root: () => {\n useEffect(() => {\n log('initializing plugins', { enabled: state.values.enabled });\n const timeout = setTimeout(async () => {\n const enabledIds = [...core, ...state.values.enabled].sort((a, b) => {\n const indexA = order.findIndex(({ id }) => id === a);\n const indexB = order.findIndex(({ id }) => id === b);\n return indexA - indexB;\n });\n\n const enabled = await Promise.all(\n enabledIds\n .map((id) => definitions[id])\n // If local storage indicates a plugin is enabled, but it is not available, ignore it.\n .filter((definition): definition is () => Promise<PluginDefinition> => Boolean(definition))\n .map((definition) => definition()),\n );\n\n const plugins = await Promise.all(\n enabled.map(async (definition) => {\n const plugin = await initializePlugin(definition).catch((err) => {\n console.error('Failed to initialize plugin:', definition.meta.id, err);\n return undefined;\n });\n return plugin;\n }),\n ).then((plugins) => plugins.filter((plugin): plugin is Plugin => Boolean(plugin)));\n log('plugins initialized', { plugins });\n\n await Promise.all(\n enabled.map(async (pluginDefinition) => {\n await pluginDefinition.ready?.(plugins);\n }),\n );\n log('plugins ready', { plugins });\n\n state.values.plugins = shallow(plugins);\n state.values.ready = true;\n });\n\n return () => {\n clearTimeout(timeout);\n state.values.ready = false;\n // TODO(wittjosiah): Does this ever need to be called prior to having dynamic plugins?\n // void Promise.all(enabled.map((definition) => definition.unload?.()));\n };\n }, []);\n\n if (!state.values.ready) {\n return <>{fallback}</>;\n }\n\n const ComposedContext = composeContext(state.values.plugins);\n\n return <ComposedContext>{rootComponents(state.values.plugins)}</ComposedContext>;\n },\n },\n };\n};\n\n/**\n * Resolve a `PluginDefinition` into a fully initialized `Plugin`.\n */\nexport const initializePlugin = async <T, U>(pluginDefinition: PluginDefinition<T, U>): Promise<Plugin<T & U>> => {\n const provides = await pluginDefinition.initialize?.();\n return {\n ...pluginDefinition,\n provides: {\n ...pluginDefinition.provides,\n ...provides,\n } as PluginProvides<T & U>,\n };\n};\n\nconst rootComponents = (plugins: Plugin[]) => {\n return plugins\n .map((plugin) => {\n const Component = plugin.provides.root;\n if (Component) {\n return <Component key={plugin.meta.id} />;\n } else {\n return null;\n }\n })\n .filter((node): node is JSX.Element => Boolean(node));\n};\n\nconst composeContext = (plugins: Plugin[]) => {\n return compose(plugins.map((p) => p.provides.context!).filter(Boolean));\n};\n\nconst compose = (contexts: FC<PropsWithChildren>[]) => {\n return [...contexts].reduce((Acc, Next) => ({ children }) => (\n <Acc>\n <Next>{children}</Next>\n </Acc>\n ));\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { Component, type FC, type PropsWithChildren } from 'react';\n\ntype Props = PropsWithChildren<{ data?: any; fallback: FC<{ error: Error; reset: () => void }> }>;\ntype State = { error: Error | undefined };\n\n/**\n * Surface error boundary.\n *\n * For basic usage prefer providing a fallback component to `Surface`.\n *\n * For more information on error boundaries, see:\n * https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary\n */\nexport class ErrorBoundary extends Component<Props, State> {\n constructor(props: Props) {\n super(props);\n this.state = { error: undefined };\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n override componentDidUpdate(prevProps: Props): void {\n if (prevProps.data !== this.props.data) {\n this.resetError();\n }\n }\n\n override render() {\n if (this.state.error) {\n return <this.props.fallback error={this.state.error} reset={this.resetError} />;\n }\n\n return this.props.children;\n }\n\n private resetError() {\n this.setState({ error: undefined });\n }\n}\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport React, { forwardRef, type FC, type ReactNode, Fragment, type ForwardedRef, type PropsWithChildren } from 'react';\nimport { createContext, useContext } from 'react';\n\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { type SurfaceComponent, useSurface } from './SurfaceRootContext';\n\n/**\n * Direction determines how multiple components are laid out.\n */\nexport type Direction = 'inline' | 'inline-reverse' | 'block' | 'block-reverse';\n\nexport type SurfaceProps = PropsWithChildren<{\n /**\n * Role defines how the data should be rendered.\n */\n role?: string;\n\n /**\n * Names allow nested surfaces to be specified in the parent context, similar to a slot.\n * Defaults to the value of `role` if not specified.\n */\n name?: string;\n\n /**\n * The data to be rendered by the surface.\n */\n data?: Record<string, unknown>;\n\n /**\n * Configure nested surfaces (indexed by the surface's `name`).\n */\n surfaces?: Record<string, Pick<SurfaceProps, 'data' | 'surfaces'>>;\n\n /**\n * If specified, the Surface will be wrapped in an error boundary.\n * The fallback component will be rendered if an error occurs.\n */\n fallback?: ErrorBoundary['props']['fallback'];\n\n /**\n * If specified, this will render if no plugin can offer renderable content for the surface.\n */\n contentFallback?: FC<{}>;\n\n /**\n * If more than one component is resolved, the limit determines how many are rendered.\n */\n limit?: number | undefined;\n\n /**\n * If more than one component is resolved, the direction determines how they are laid out.\n * NOTE: This is not yet implemented.\n */\n direction?: Direction;\n\n /**\n * Additional props to pass to the component.\n * These props are not used by Surface itself but may be used by components which resolve the surface.\n */\n [key: string]: unknown;\n}>;\n\n/**\n * A surface is a named region of the screen that can be populated by plugins.\n */\nexport const Surface = forwardRef<HTMLElement, SurfaceProps>(\n ({ role, name = role, fallback, ...rest }, forwardedRef) => {\n const props = { role, name, fallback, ...rest };\n const context = useContext(SurfaceContext);\n const data = props.data ?? ((name && context?.surfaces?.[name]?.data) || {});\n\n return (\n <>\n {fallback ? (\n <ErrorBoundary data={data} fallback={fallback}>\n <SurfaceResolver {...props} ref={forwardedRef} />\n </ErrorBoundary>\n ) : (\n <SurfaceResolver {...props} ref={forwardedRef} />\n )}\n </>\n );\n },\n);\n\nconst SurfaceContext = createContext<SurfaceProps | null>(null);\n\nconst SurfaceResolver = forwardRef<HTMLElement, SurfaceProps>((props, forwardedRef) => {\n const { components } = useSurface();\n const parent = useContext(SurfaceContext);\n const nodes = resolveNodes(components, props, parent, forwardedRef);\n const currentContext: SurfaceProps = {\n ...props,\n surfaces: {\n ...((props.name && parent?.surfaces?.[props.name]?.surfaces) || {}),\n ...props.surfaces,\n },\n };\n\n return (\n <SurfaceContext.Provider value={currentContext}>\n {nodes.length > 0 ? nodes : props.contentFallback ? <props.contentFallback /> : null}\n </SurfaceContext.Provider>\n );\n});\n\nconst resolveNodes = (\n components: Record<string, SurfaceComponent>,\n props: SurfaceProps,\n context: SurfaceProps | null,\n forwardedRef: ForwardedRef<HTMLElement>,\n): ReactNode[] => {\n const data = {\n ...((props.name && context?.surfaces?.[props.name]?.data) || {}),\n ...props.data,\n };\n\n const nodes = Object.entries(components)\n .map(([key, component]) => {\n const result = component({ ...props, data }, forwardedRef);\n return result ? <Fragment key={key}>{result}</Fragment> : undefined;\n })\n .filter((Component): Component is JSX.Element => Boolean(Component));\n\n return props.limit ? nodes.slice(0, props.limit) : nodes;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { type BootstrapPluginsParams, PluginHost, Plugin } from './plugins';\nimport IntentMeta from './plugins/IntentPlugin/meta';\nimport SurfaceMeta from './plugins/SurfacePlugin/meta';\n\n/**\n * Expected usage is for this to be the entrypoint of the application.\n * Initializes plugins and renders the root components.\n *\n * @example\n * const order = [LayoutMeta, MyPluginMeta];\n * const plugins = {\n * [LayoutMeta.id]: Plugin.lazy(() => import('./plugins/LayoutPlugin/plugin')),\n * [MyPluginMeta.id]: Plugin.lazy(() => import('./plugins/MyPlugin/plugin')),\n * };\n * const core = [LayoutMeta.id];\n * const default = [MyPluginMeta.id];\n * const fallback = <div>Initializing Plugins...</div>;\n * const App = createApp({ order, plugins, core, default, fallback });\n * createRoot(document.getElementById('root')!).render(\n * <StrictMode>\n * <App />\n * </StrictMode>,\n * );\n *\n * @param params.order Total ordering of plugins.\n * @param params.plugins All plugins available to the application.\n * @param params.core Core plugins which will always be enabled.\n * @param params.default Default plugins are enabled by default but can be disabled by the user.\n * @param params.fallback Fallback component to render while plugins are initializing.\n */\nexport const createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }: BootstrapPluginsParams) => {\n const host = PluginHost({\n order: [SurfaceMeta, IntentMeta, ...order],\n plugins: {\n ...plugins,\n [SurfaceMeta.id]: Plugin.lazy(() => import('./plugins/SurfacePlugin/plugin')),\n [IntentMeta.id]: Plugin.lazy(() => import('./plugins/IntentPlugin/plugin')),\n },\n core: [SurfaceMeta.id, IntentMeta.id, ...core],\n ...params,\n });\n\n invariant(host.provides?.context);\n invariant(host.provides?.root);\n const Context = host.provides.context;\n const Root = host.provides.root;\n\n return () => (\n <Context>\n <Root />\n </Context>\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAyBO,IAAMA,mBAAmB,CAACC,WAC9BA,OAAOC,SAAiBC,OAAOC,OAAQH,
|
|
6
|
-
"names": ["parseGraphPlugin", "plugin", "provides", "graph", "root", "undefined", "parseGraphBuilderPlugin", "builder", "z", "Layout", "z", "object", "fullscreen", "boolean", "sidebarOpen", "complementarySidebarOpen", "dialogContent", "any", "optional", "describe", "dialogOpen", "popoverAnchorId", "string", "popoverContent", "popoverOpen", "active", "previous", "parseLayoutPlugin", "plugin", "success", "safeParse", "provides", "layout", "undefined", "LAYOUT_ACTION", "LayoutAction", "TOGGLE_FULLSCREEN", "TOGGLE_SIDEBAR", "TOGGLE_COMPLEMENTARY_SIDEBAR", "OPEN_DIALOG", "CLOSE_DIALOG", "OPEN_POPOVER", "CLOSE_POPOVER", "ACTIVATE", "parseMetadataRecordsPlugin", "plugin", "provides", "metadata", "records", "undefined", "parseMetadataResolverPlugin", "resolver", "z", "ResourceKey", "z", "union", "string", "record", "any", "ResourceLanguage", "Resource", "parseTranslationsPlugin", "plugin", "success", "array", "safeParse", "provides", "translations", "undefined", "pluginMeta", "meta", "Plugin", "lazy", "p", "props", "then", "default", "definition", "createContext", "useContext", "PluginContext", "createContext", "ready", "enabled", "plugins", "available", "enablePlugin", "disablePlugin", "usePlugins", "useContext", "usePlugin", "id", "findPlugin", "useResolvePlugin", "predicate", "resolvePlugin", "PluginProvider", "Provider", "shallow", "React", "useEffect", "LocalStorageStore", "log", "parsePluginHost", "plugin", "provides", "plugins", "undefined", "PLUGIN_HOST", "PluginHost", "order", "definitions", "core", "defaults", "fallback", "state", "LocalStorageStore", "ready", "enabled", "available", "filter", "id", "includes", "enablePlugin", "values", "disablePlugin", "prop", "$enabled", "json", "meta", "name", "context", "children", "PluginProvider", "value", "root", "useEffect", "log", "timeout", "setTimeout", "enabledIds", "sort", "a", "b", "indexA", "findIndex", "indexB", "Promise", "all", "map", "definition", "Boolean", "initializePlugin", "catch", "err", "console", "error", "then", "pluginDefinition", "shallow", "clearTimeout", "ComposedContext", "composeContext", "rootComponents", "initialize", "Component", "key", "node", "compose", "p", "contexts", "reduce", "Acc", "Next", "React", "Component", "ErrorBoundary", "Component", "constructor", "props", "state", "error", "undefined", "getDerivedStateFromError", "componentDidUpdate", "prevProps", "data", "resetError", "render", "React", "this", "fallback", "reset", "children", "setState", "React", "forwardRef", "Fragment", "createContext", "useContext", "Surface", "forwardRef", "role", "name", "fallback", "rest", "forwardedRef", "props", "context", "useContext", "SurfaceContext", "data", "surfaces", "React", "ErrorBoundary", "SurfaceResolver", "ref", "createContext", "components", "useSurface", "parent", "nodes", "resolveNodes", "currentContext", "Provider", "value", "length", "contentFallback", "Object", "entries", "map", "key", "component", "result", "
|
|
3
|
+
"sources": ["../../../src/plugins/common/graph.ts", "../../../src/plugins/common/layout.ts", "../../../src/plugins/common/metadata.ts", "../../../src/plugins/common/translations.ts", "../../../src/plugins/PluginHost/plugin.ts", "../../../src/plugins/PluginHost/PluginContext.tsx", "../../../src/plugins/PluginHost/PluginHost.tsx", "../../../src/plugins/SurfacePlugin/helpers.ts", "../../../src/plugins/SurfacePlugin/ErrorBoundary.tsx", "../../../src/plugins/SurfacePlugin/Surface.tsx", "../../../src/App.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Graph, Node } from '@dxos/app-graph';\nimport type { UnsubscribeCallback } from '@dxos/async';\n\nimport type { Plugin } from '../PluginHost';\n\n/**\n * Provides for a plugin that exposes the application graph.\n */\nexport type GraphProvides = {\n graph: Graph;\n};\n\nexport type GraphBuilderProvides = {\n graph: {\n builder: (params: { parent: Node; plugins: Plugin[] }) => UnsubscribeCallback | void;\n };\n};\n\n/**\n * Type guard for graph plugins.\n */\nexport const parseGraphPlugin = (plugin: Plugin) =>\n (plugin.provides as any).graph?.root ? (plugin as Plugin<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 { Plugin } from '../PluginHost';\n\n//\n// Provides\n//\n\n/**\n * Basic state provided by a layout plugin.\n */\nexport const Layout = z.object({\n fullscreen: z.boolean(),\n sidebarOpen: z.boolean(),\n complementarySidebarOpen: z.boolean(),\n\n dialogContent: z.any().optional().describe('Data to be passed to the dialog Surface.'),\n dialogOpen: z.boolean(),\n\n popoverAnchorId: z.string().optional(),\n popoverContent: z.any().optional().describe('Data to be passed to the popover Surface.'),\n popoverOpen: z.boolean(),\n\n // TODO(wittjosiah): Array?\n active: z.string().optional().describe('Id of the currently active item.'),\n // TODO(wittjosiah): History?\n previous: z.string().optional(),\n});\n\nexport type Layout = z.infer<typeof Layout>;\n\n/**\n * Provides for a plugin that can manage the app layout.\n */\nexport type LayoutProvides = {\n layout: Readonly<Layout>;\n};\n\n/**\n * Type guard for layout plugins.\n */\nexport const parseLayoutPlugin = (plugin: Plugin) => {\n const { success } = Layout.safeParse((plugin.provides as any).layout);\n return success ? (plugin as Plugin<LayoutProvides>) : undefined;\n};\n\n//\n// Intents\n//\n\nconst LAYOUT_ACTION = 'dxos.org/plugin/intent';\n// TODO(wittjosiah): Consider consolidating some action types (e.g. toggle).\nexport enum LayoutAction {\n TOGGLE_FULLSCREEN = `${LAYOUT_ACTION}/toggle-fullscreen`,\n TOGGLE_SIDEBAR = `${LAYOUT_ACTION}/toggle-sidebar`,\n TOGGLE_COMPLEMENTARY_SIDEBAR = `${LAYOUT_ACTION}/toggle-complementary-sidebar`,\n OPEN_DIALOG = `${LAYOUT_ACTION}/open-dialog`,\n CLOSE_DIALOG = `${LAYOUT_ACTION}/close-dialog`,\n OPEN_POPOVER = `${LAYOUT_ACTION}/open-popover`,\n CLOSE_POPOVER = `${LAYOUT_ACTION}/close-popover`,\n ACTIVATE = `${LAYOUT_ACTION}/activate`,\n}\n\n/**\n * Expected payload for layout actions.\n */\nexport namespace LayoutAction {\n export type ToggleFullscreen = {\n state?: boolean;\n };\n\n export type ToggleSidebar = {\n state?: boolean;\n };\n\n export type ToggleComplementarySidebar = {\n state?: boolean;\n };\n\n export type OpenDialog = {\n component: string;\n subject: any;\n };\n\n export type CloseDialog = {};\n\n export type OpenPopover = {\n anchorId: string;\n component: string;\n subject: any;\n };\n\n export type ClosePopover = {};\n\n export type Activate = {\n id: string;\n };\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Plugin } from '../PluginHost';\n\nexport type Metadata = Record<string, any>;\n\nexport type MetadataRecordsProvides = {\n metadata: {\n records: Record<string, Metadata>;\n };\n};\n\nexport type MetadataResolver = (type: string) => Metadata;\n\nexport type MetadataResolverProvides = {\n metadata: {\n resolver: MetadataResolver;\n };\n};\n\nexport const parseMetadataRecordsPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).metadata?.records ? (plugin as Plugin<MetadataRecordsProvides>) : undefined;\n};\n\nexport const parseMetadataResolverPlugin = (plugin: Plugin) => {\n return (plugin.provides as any).metadata?.resolver ? (plugin as Plugin<MetadataResolverProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { z } from 'zod';\n\nimport type { Plugin } from '../PluginHost';\n\nexport const ResourceKey = z.union([z.string(), z.record(z.any())]);\nexport type ResourceKey = z.infer<typeof ResourceKey>;\n\nexport const ResourceLanguage = z.record(ResourceKey);\nexport type ResourceLanguage = z.infer<typeof ResourceLanguage>;\n\n/**\n * A resource is a collection of translations for a language.\n */\nexport const Resource = z.record(ResourceLanguage);\nexport type Resource = z.infer<typeof Resource>;\n\n/**\n * Provides for a plugin that exposes translations.\n */\n// TODO(wittjosiah): Rename to TranslationResourcesProvides.\nexport type TranslationsProvides = {\n translations: Readonly<Resource[]>;\n};\n\n// TODO(wittjosiah): Add TranslationsProvides.\n// export type TranslationsProvides = {\n// translations: {\n// t: TFunction;\n// };\n// };\n\n/**\n * Type guard for translation plugins.\n */\nexport const parseTranslationsPlugin = (plugin: Plugin) => {\n const { success } = z.array(Resource).safeParse((plugin.provides as any).translations);\n return success ? (plugin as Plugin<TranslationsProvides>) : undefined;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { IconProps } from '@phosphor-icons/react';\nimport type { FC, PropsWithChildren } from 'react';\n\n/**\n * Capabilities provided by a plugin.\n * The base surface capabilities are always included.\n */\nexport type PluginProvides<TProvides> = TProvides & {\n /**\n * React Context which is wrapped around the application to enable any hooks the plugin may provide.\n */\n context?: FC<PropsWithChildren>;\n\n /*\n * React component which is rendered at the root of the application.\n */\n root?: FC<PropsWithChildren>;\n};\n\n/**\n * A unit of containment of modular functionality that can be provided to an application.\n * Plugins provide things like components, state, actions, etc. to the application.\n */\nexport type Plugin<TProvides = {}> = {\n meta: {\n /**\n * Globally unique ID.\n *\n * Expected to be in the form of a valid URL.\n *\n * @example dxos.org/plugin/example\n */\n id: string;\n\n /**\n * Short ID for use in URLs.\n *\n * NOTE: This is especially experimental and likely to change.\n */\n // TODO(wittjosiah): How should these be managed?\n shortId?: string;\n\n /**\n * Human readable name.\n */\n name?: string;\n\n /**\n * Short description of plugin functionality.\n */\n description?: string;\n\n /**\n * Component to render icon for the plugin when displayed in a list.\n */\n // TODO(wittjosiah): Convert to `icon` and make serializable.\n iconComponent?: FC<IconProps>;\n };\n\n /**\n * Capabilities provided by the plugin.\n */\n provides: PluginProvides<TProvides>;\n};\n\n/**\n * Plugin definitions extend the base `Plugin` interface with additional lifecycle methods.\n */\nexport type PluginDefinition<TProvides = {}, TInitializeProvides = {}> = Omit<Plugin, 'provides'> & {\n /**\n * Capabilities provided by the plugin.\n */\n provides?: Plugin<TProvides>['provides'];\n\n /**\n * Initialize any async behavior required by the plugin.\n *\n * @return Capabilities provided by the plugin which are merged with base capabilities.\n */\n initialize?: () => Promise<PluginProvides<TInitializeProvides>>;\n\n /**\n * Called once all plugins have been initialized.\n * This is the place to do any initialization which requires other plugins to be ready.\n *\n * @param plugins All plugins which successfully initialized.\n */\n ready?: (plugins: Plugin[]) => Promise<void>;\n\n /**\n * Called when the plugin is unloaded.\n * This is the place to do any cleanup required by the plugin.\n */\n unload?: () => Promise<void>;\n};\n\nexport const pluginMeta = (meta: Plugin['meta']) => meta;\n\ntype LazyPlugin<T> = () => Promise<{ default: (props: T) => PluginDefinition }>;\n\nexport namespace Plugin {\n export const lazy = <T>(p: LazyPlugin<T>, props?: T) => {\n return () =>\n p().then(({ default: definition }) => {\n return definition(props as T);\n });\n };\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Context, type Provider, createContext, useContext } from 'react';\n\nimport { type Plugin } from './plugin';\nimport { findPlugin, resolvePlugin } from '../helpers';\n\nexport type PluginContext = {\n /**\n * All plugins are ready.\n */\n ready: boolean;\n\n /**\n * Ids of plugins which are enabled on this device.\n */\n enabled: string[];\n\n /**\n * Initialized and ready plugins.\n */\n plugins: Plugin[];\n\n /**\n * All available plugins.\n */\n available: Plugin['meta'][];\n\n /**\n * Mark plugin as enabled.\n *\n * Requires reload to take effect.\n */\n enablePlugin: (id: string) => void;\n\n /**\n * Mark plugin as disabled.\n *\n * Requires reload to take effect.\n */\n disablePlugin: (id: string) => void;\n};\n\nconst PluginContext: Context<PluginContext> = createContext<PluginContext>({\n ready: false,\n enabled: [],\n plugins: [],\n available: [],\n enablePlugin: () => {},\n disablePlugin: () => {},\n});\n\n/**\n * Get all plugins.\n */\nexport const usePlugins = (): PluginContext => useContext(PluginContext);\n\n/**\n * Get a plugin by ID.\n */\nexport const usePlugin = <T,>(id: string): Plugin<T> | undefined => {\n const { plugins } = usePlugins();\n return findPlugin<T>(plugins, id);\n};\n\n/**\n * Resolve a plugin by predicate.\n */\nexport const useResolvePlugin = <T,>(predicate: (plugin: Plugin) => Plugin<T> | undefined): Plugin<T> | undefined => {\n const { plugins } = usePlugins();\n return resolvePlugin(plugins, predicate);\n};\n\nexport const PluginProvider: Provider<PluginContext> = PluginContext.Provider;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { shallow } from 'deepsignal/react';\nimport React, { useEffect, type FC, type PropsWithChildren, type ReactNode } from 'react';\n\nimport { LocalStorageStore } from '@dxos/local-storage';\nimport { log } from '@dxos/log';\n\nimport { type PluginContext, PluginProvider } from './PluginContext';\nimport { type Plugin, type PluginDefinition, type PluginProvides } from './plugin';\n\nexport type BootstrapPluginsParams = {\n order: PluginDefinition['meta'][];\n plugins: Record<string, () => Promise<PluginDefinition>>;\n core?: string[];\n defaults?: string[];\n fallback?: ReactNode;\n};\n\nexport type PluginHostProvides = {\n plugins: PluginContext;\n};\n\nexport const parsePluginHost = (plugin: Plugin) =>\n (plugin.provides as PluginHostProvides).plugins ? (plugin as Plugin<PluginHostProvides>) : undefined;\n\nconst PLUGIN_HOST = 'dxos.org/plugin/host';\n\n/**\n * Bootstraps an application by initializing plugins and rendering root components.\n */\nexport const PluginHost = ({\n order,\n plugins: definitions,\n core = [],\n defaults = [],\n fallback = null,\n}: BootstrapPluginsParams): PluginDefinition<PluginHostProvides> => {\n const state = new LocalStorageStore<PluginContext>(PLUGIN_HOST, {\n ready: false,\n enabled: [...defaults],\n plugins: [],\n available: order.filter(({ id }) => !core.includes(id)),\n enablePlugin: (id: string) => {\n state.values.enabled = [...state.values.enabled, id];\n },\n disablePlugin: (id: string) => {\n state.values.enabled = state.values.enabled.filter((enabled) => enabled !== id);\n },\n });\n\n state.prop(state.values.$enabled!, 'enabled', LocalStorageStore.json);\n\n return {\n meta: {\n id: PLUGIN_HOST,\n name: 'Plugin host',\n },\n provides: {\n plugins: state.values,\n context: ({ children }) => <PluginProvider value={state.values}>{children}</PluginProvider>,\n root: () => {\n useEffect(() => {\n log('initializing plugins', { enabled: state.values.enabled });\n const timeout = setTimeout(async () => {\n const enabledIds = [...core, ...state.values.enabled].sort((a, b) => {\n const indexA = order.findIndex(({ id }) => id === a);\n const indexB = order.findIndex(({ id }) => id === b);\n return indexA - indexB;\n });\n\n const enabled = await Promise.all(\n enabledIds\n .map((id) => definitions[id])\n // If local storage indicates a plugin is enabled, but it is not available, ignore it.\n .filter((definition): definition is () => Promise<PluginDefinition> => Boolean(definition))\n .map((definition) => definition()),\n );\n\n const plugins = await Promise.all(\n enabled.map(async (definition) => {\n const plugin = await initializePlugin(definition).catch((err) => {\n console.error('Failed to initialize plugin:', definition.meta.id, err);\n return undefined;\n });\n return plugin;\n }),\n ).then((plugins) => plugins.filter((plugin): plugin is Plugin => Boolean(plugin)));\n log('plugins initialized', { plugins });\n\n await Promise.all(\n enabled.map(async (pluginDefinition) => {\n await pluginDefinition.ready?.(plugins);\n }),\n );\n log('plugins ready', { plugins });\n\n state.values.plugins = shallow(plugins);\n state.values.ready = true;\n });\n\n return () => {\n clearTimeout(timeout);\n state.values.ready = false;\n // TODO(wittjosiah): Does this ever need to be called prior to having dynamic plugins?\n // void Promise.all(enabled.map((definition) => definition.unload?.()));\n };\n }, []);\n\n if (!state.values.ready) {\n return <>{fallback}</>;\n }\n\n const ComposedContext = composeContext(state.values.plugins);\n\n return <ComposedContext>{rootComponents(state.values.plugins)}</ComposedContext>;\n },\n },\n };\n};\n\n/**\n * Resolve a `PluginDefinition` into a fully initialized `Plugin`.\n */\nexport const initializePlugin = async <T, U>(pluginDefinition: PluginDefinition<T, U>): Promise<Plugin<T & U>> => {\n const provides = await pluginDefinition.initialize?.();\n return {\n ...pluginDefinition,\n provides: {\n ...pluginDefinition.provides,\n ...provides,\n } as PluginProvides<T & U>,\n };\n};\n\nconst rootComponents = (plugins: Plugin[]) => {\n return plugins\n .map((plugin) => {\n const Component = plugin.provides.root;\n if (Component) {\n return <Component key={plugin.meta.id} />;\n } else {\n return null;\n }\n })\n .filter((node): node is JSX.Element => Boolean(node));\n};\n\nconst composeContext = (plugins: Plugin[]) => {\n return compose(plugins.map((p) => p.provides.context!).filter(Boolean));\n};\n\nconst compose = (contexts: FC<PropsWithChildren>[]) => {\n return [...contexts].reduce((Acc, Next) => ({ children }) => (\n <Acc>\n <Next>{children}</Next>\n </Acc>\n ));\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\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 FC,\n type ReactNode,\n Fragment,\n type ForwardedRef,\n type PropsWithChildren,\n isValidElement,\n} from 'react';\nimport { createContext, useContext } from 'react';\n\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { type SurfaceComponent, useSurface, type SurfaceResult } from './SurfaceRootContext';\n\n/**\n * Direction determines how multiple components are laid out.\n */\nexport type Direction = 'inline' | 'inline-reverse' | 'block' | 'block-reverse';\n\nexport type SurfaceProps = PropsWithChildren<{\n /**\n * Role defines how the data should be rendered.\n */\n role?: string;\n\n /**\n * Names allow nested surfaces to be specified in the parent context, similar to a slot.\n * Defaults to the value of `role` if not specified.\n */\n name?: string;\n\n /**\n * The data to be rendered by the surface.\n */\n data?: Record<string, unknown>;\n\n /**\n * Configure nested surfaces (indexed by the surface's `name`).\n */\n surfaces?: Record<string, Pick<SurfaceProps, 'data' | 'surfaces'>>;\n\n /**\n * If specified, the Surface will be wrapped in an error boundary.\n * The fallback component will be rendered if an error occurs.\n */\n fallback?: ErrorBoundary['props']['fallback'];\n\n /**\n * If specified, this will render if no plugin can offer renderable content for the surface.\n *\n * @deprecated Provide a component with `disposition: 'fallback'` instead.\n */\n contentFallback?: FC<{}>;\n\n /**\n * If more than one component is resolved, the limit determines how many are rendered.\n */\n limit?: number | undefined;\n\n /**\n * If more than one component is resolved, the direction determines how they are laid out.\n * NOTE: This is not yet implemented.\n */\n direction?: Direction;\n\n /**\n * Additional props to pass to the component.\n * These props are not used by Surface itself but may be used by components which resolve the surface.\n */\n [key: string]: unknown;\n}>;\n\n/**\n * A surface is a named region of the screen that can be populated by plugins.\n */\nexport const Surface = forwardRef<HTMLElement, SurfaceProps>(\n ({ role, name = role, fallback, ...rest }, forwardedRef) => {\n const props = { role, name, fallback, ...rest };\n const context = useContext(SurfaceContext);\n const data = props.data ?? ((name && context?.surfaces?.[name]?.data) || {});\n\n return (\n <>\n {fallback ? (\n <ErrorBoundary data={data} fallback={fallback}>\n <SurfaceResolver {...props} ref={forwardedRef} />\n </ErrorBoundary>\n ) : (\n <SurfaceResolver {...props} ref={forwardedRef} />\n )}\n </>\n );\n },\n);\n\nconst SurfaceContext = createContext<SurfaceProps | null>(null);\n\nconst SurfaceResolver = forwardRef<HTMLElement, SurfaceProps>((props, forwardedRef) => {\n const { components } = useSurface();\n const parent = useContext(SurfaceContext);\n const nodes = resolveNodes(components, props, parent, forwardedRef);\n const currentContext: SurfaceProps = {\n ...props,\n surfaces: {\n ...((props.name && parent?.surfaces?.[props.name]?.surfaces) || {}),\n ...props.surfaces,\n },\n };\n\n return (\n <SurfaceContext.Provider value={currentContext}>\n {nodes.length > 0 ? nodes : props.contentFallback ? <props.contentFallback /> : null}\n </SurfaceContext.Provider>\n );\n});\n\nconst resolveNodes = (\n components: Record<string, SurfaceComponent>,\n props: SurfaceProps,\n context: SurfaceProps | null,\n forwardedRef: ForwardedRef<HTMLElement>,\n): ReactNode[] => {\n const data = {\n ...((props.name && context?.surfaces?.[props.name]?.data) || {}),\n ...props.data,\n };\n\n const nodes = Object.entries(components)\n .map(([key, component]): [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": ";;;;;;;;;;;;;;;;;;;;;;AAyBO,IAAMA,mBAAmB,CAACC,WAC9BA,OAAOC,SAAiBC,OAAOC,OAAQH,SAAmCI;AAKtE,IAAMC,0BAA0B,CAACL,WACrCA,OAAOC,SAAiBC,OAAOI,UAAWN,SAA0CI;;;AC5BvF,SAASG,SAAS;AAWX,IAAMC,SAASC,EAAEC,OAAO;EAC7BC,YAAYF,EAAEG,QAAO;EACrBC,aAAaJ,EAAEG,QAAO;EACtBE,0BAA0BL,EAAEG,QAAO;EAEnCG,eAAeN,EAAEO,IAAG,EAAGC,SAAQ,EAAGC,SAAS,0CAAA;EAC3CC,YAAYV,EAAEG,QAAO;EAErBQ,iBAAiBX,EAAEY,OAAM,EAAGJ,SAAQ;EACpCK,gBAAgBb,EAAEO,IAAG,EAAGC,SAAQ,EAAGC,SAAS,2CAAA;EAC5CK,aAAad,E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Y,CAAC,EAAEC,OAAOC,SAASC,OAAOF,MAAMG,IAAI,CAAC,EAAEC,GAAE,MAAOA,EAAAA,GAAK,GAAGC,OAAAA,MAAgC;AAC/G,QAAMC,OAAOC,WAAW;IACtBP,OAAO;MAACQ;MAAaC;SAAeT;;IACpCC,SAAS;MACP,GAAGA;MACH,CAACO,cAAYJ,EAAE,GAAGM,OAAOC,KAAK,MAAM,OAAO,uBAAA,CAAA;MAC3C,CAACF,aAAWL,EAAE,GAAGM,OAAOC,KAAK,MAAM,OAAO,uBAAA,CAAA;IAC5C;IACAT,MAAM;MAACM,cAAYJ;MAAIK,aAAWL;SAAOF;;IACzC,GAAGG;EACL,CAAA;AAEAO,YAAUN,KAAKO,UAAUC,SAAAA,QAAAA;;;;;;;;;AACzBF,YAAUN,KAAKO,UAAUE,MAAAA,QAAAA;;;;;;;;;AACzB,QAAMC,UAAUV,KAAKO,SAASC;AAC9B,QAAMG,OAAOX,KAAKO,SAASE;AAE3B,SAAO,MACL,gBAAAG,OAAA,cAACF,SAAAA,MACC,gBAAAE,OAAA,cAACD,MAAAA,IAAAA,CAAAA;AAGP;",
|
|
6
|
+
"names": ["parseGraphPlugin", "plugin", "provides", "graph", "root", "undefined", "parseGraphBuilderPlugin", "builder", "z", "Layout", "z", "object", "fullscreen", "boolean", "sidebarOpen", "complementarySidebarOpen", "dialogContent", "any", "optional", "describe", "dialogOpen", "popoverAnchorId", "string", "popoverContent", "popoverOpen", "active", "previous", "parseLayoutPlugin", "plugin", "success", "safeParse", "provides", "layout", "undefined", "LAYOUT_ACTION", "LayoutAction", "TOGGLE_FULLSCREEN", "TOGGLE_SIDEBAR", "TOGGLE_COMPLEMENTARY_SIDEBAR", "OPEN_DIALOG", "CLOSE_DIALOG", "OPEN_POPOVER", "CLOSE_POPOVER", "ACTIVATE", "parseMetadataRecordsPlugin", "plugin", "provides", "metadata", "records", "undefined", "parseMetadataResolverPlugin", "resolver", "z", "ResourceKey", "z", "union", "string", "record", "any", "ResourceLanguage", "Resource", "parseTranslationsPlugin", "plugin", "success", "array", "safeParse", "provides", "translations", "undefined", "pluginMeta", "meta", "Plugin", "lazy", "p", "props", "then", "default", "definition", "createContext", "useContext", "PluginContext", "createContext", "ready", "enabled", "plugins", "available", "enablePlugin", "disablePlugin", "usePlugins", "useContext", "usePlugin", "id", "findPlugin", "useResolvePlugin", "predicate", "resolvePlugin", "PluginProvider", "Provider", "shallow", "React", "useEffect", "LocalStorageStore", "log", "parsePluginHost", "plugin", "provides", "plugins", "undefined", "PLUGIN_HOST", "PluginHost", "order", "definitions", "core", "defaults", "fallback", "state", "LocalStorageStore", "ready", "enabled", "available", "filter", "id", "includes", "enablePlugin", "values", "disablePlugin", "prop", "$enabled", "json", "meta", "name", "context", "children", "PluginProvider", "value", "root", "useEffect", "log", "timeout", "setTimeout", "enabledIds", "sort", "a", "b", "indexA", "findIndex", "indexB", "Promise", "all", "map", "definition", "Boolean", "initializePlugin", "catch", "err", "console", "error", "then", "pluginDefinition", "shallow", "clearTimeout", "ComposedContext", "composeContext", "rootComponents", "initialize", "Component", "key", "node", "compose", "p", "contexts", "reduce", "Acc", "Next", "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", "createContext", "useContext", "Surface", "forwardRef", "role", "name", "fallback", "rest", "forwardedRef", "props", "context", "useContext", "SurfaceContext", "data", "surfaces", "React", "ErrorBoundary", "SurfaceResolver", "ref", "createContext", "components", "useSurface", "parent", "nodes", "resolveNodes", "currentContext", "Provider", "value", "length", "contentFallback", "Object", "entries", "map", "key", "component", "result", "undefined", "isValidElement", "node", "filter", "Boolean", "sort", "a", "b", "aDisposition", "disposition", "bDisposition", "Fragment", "limit", "slice", "React", "invariant", "createApp", "order", "plugins", "core", "map", "id", "params", "host", "PluginHost", "SurfaceMeta", "IntentMeta", "Plugin", "lazy", "invariant", "provides", "context", "root", "Context", "Root", "React"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytes":2213,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytes":7754,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/metadata.ts":{"bytes":2058,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/translations.ts":{"bytes":3465,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/index.ts":{"bytes":748,"imports":[{"path":"packages/sdk/app-framework/src/plugins/common/graph.ts","kind":"import-statement","original":"./graph"},{"path":"packages/sdk/app-framework/src/plugins/common/layout.ts","kind":"import-statement","original":"./layout"},{"path":"packages/sdk/app-framework/src/plugins/common/metadata.ts","kind":"import-statement","original":"./metadata"},{"path":"packages/sdk/app-framework/src/plugins/common/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/helpers.ts":{"bytes":4017,"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/intent.ts":{"bytes":1706,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytes":1874,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytes":1616,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/index.ts":{"bytes":678,"imports":[{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/intent.ts","kind":"import-statement","original":"./intent"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx","kind":"import-statement","original":"./IntentContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts":{"bytes":5027,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytes":4312,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx":{"bytes":18413,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/local-storage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx","kind":"import-statement","original":"./PluginContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/index.ts":{"bytes":678,"imports":[{"path":"packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts","kind":"import-statement","original":"./plugin"},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx","kind":"import-statement","original":"./PluginContext"},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx","kind":"import-statement","original":"./PluginHost"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytes":1954,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx":{"bytes":4120,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx":{"bytes":2395,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytes":10679,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx","kind":"import-statement","original":"./ErrorBoundary"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx","kind":"import-statement","original":"./SurfaceRootContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts":{"bytes":794,"imports":[{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx","kind":"import-statement","original":"./ErrorBoundary"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx","kind":"import-statement","original":"./Surface"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx","kind":"import-statement","original":"./SurfaceRootContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/index.ts":{"bytes":854,"imports":[{"path":"packages/sdk/app-framework/src/plugins/common/index.ts","kind":"import-statement","original":"./common"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"./helpers"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/index.ts","kind":"import-statement","original":"./IntentPlugin"},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/index.ts","kind":"import-statement","original":"./PluginHost"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts","kind":"import-statement","original":"./SurfacePlugin"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts":{"bytes":690,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts":{"bytes":698,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx":{"bytes":4010,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx","kind":"import-statement","original":"./SurfaceRootContext"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx":{"bytes":7167,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx","kind":"import-statement","original":"./IntentContext"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/App.tsx":{"bytes":6903,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./plugins/IntentPlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts","kind":"import-statement","original":"./plugins/SurfacePlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/SurfacePlugin/plugin"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/IntentPlugin/plugin"}],"format":"esm"},"packages/sdk/app-framework/src/index.ts":{"bytes":544,"imports":[{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/App.tsx","kind":"import-statement","original":"./App"}],"format":"esm"}},"outputs":{"packages/sdk/app-framework/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":34423},"packages/sdk/app-framework/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-WDA7VA54.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-C2K6M6WC.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-CFZ5JAJF.mjs","kind":"import-statement"},{"path":"zod","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/local-storage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/dist/lib/browser/plugin-XEJ5RYCP.mjs","kind":"dynamic-import"},{"path":"packages/sdk/app-framework/dist/lib/browser/plugin-CBPJO5NB.mjs","kind":"dynamic-import"}],"exports":["ErrorBoundary","IntentProvider","Layout","LayoutAction","Plugin","PluginHost","PluginProvider","Resource","ResourceKey","ResourceLanguage","Surface","SurfaceProvider","createApp","filterPlugins","findPlugin","getPlugin","initializePlugin","parseGraphBuilderPlugin","parseGraphPlugin","parseIntentPlugin","parseIntentResolverPlugin","parseLayoutPlugin","parseMetadataRecordsPlugin","parseMetadataResolverPlugin","parsePluginHost","parseRootSurfacePlugin","parseSurfacePlugin","parseTranslationsPlugin","pluginMeta","resolvePlugin","useIntent","usePlugin","usePlugins","useResolvePlugin","useSurface"],"entryPoint":"packages/sdk/app-framework/src/index.ts","inputs":{"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytesInOutput":174},"packages/sdk/app-framework/src/plugins/common/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytesInOutput":1724},"packages/sdk/app-framework/src/plugins/common/metadata.ts":{"bytesInOutput":226},"packages/sdk/app-framework/src/plugins/common/translations.ts":{"bytesInOutput":357},"packages/sdk/app-framework/src/plugins/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/IntentPlugin/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts":{"bytesInOutput":241},"packages/sdk/app-framework/src/plugins/PluginHost/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytesInOutput":545},"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx":{"bytesInOutput":4479},"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx":{"bytesInOutput":676},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytesInOutput":2029},"packages/sdk/app-framework/src/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/App.tsx":{"bytesInOutput":1151}},"bytes":13311},"packages/sdk/app-framework/dist/lib/browser/plugin-XEJ5RYCP.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2039},"packages/sdk/app-framework/dist/lib/browser/plugin-XEJ5RYCP.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-WDA7VA54.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-CFZ5JAJF.mjs","kind":"import-statement"},{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx","inputs":{"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx":{"bytesInOutput":680}},"bytes":985},"packages/sdk/app-framework/dist/lib/browser/chunk-WDA7VA54.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2799},"packages/sdk/app-framework/dist/lib/browser/chunk-WDA7VA54.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true}],"exports":["SurfaceProvider","meta_default","parseRootSurfacePlugin","parseSurfacePlugin","useSurface"],"inputs":{"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytesInOutput":191},"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx":{"bytesInOutput":235},"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts":{"bytesInOutput":87}},"bytes":879},"packages/sdk/app-framework/dist/lib/browser/plugin-CBPJO5NB.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3442},"packages/sdk/app-framework/dist/lib/browser/plugin-CBPJO5NB.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-C2K6M6WC.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-CFZ5JAJF.mjs","kind":"import-statement"},{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx","inputs":{"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx":{"bytesInOutput":1348}},"bytes":1672},"packages/sdk/app-framework/dist/lib/browser/chunk-C2K6M6WC.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2163},"packages/sdk/app-framework/dist/lib/browser/chunk-C2K6M6WC.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true}],"exports":["IntentProvider","meta_default","parseIntentPlugin","parseIntentResolverPlugin","useIntent"],"inputs":{"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytesInOutput":184},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytesInOutput":231},"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts":{"bytesInOutput":84}},"bytes":857},"packages/sdk/app-framework/dist/lib/browser/chunk-CFZ5JAJF.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2110},"packages/sdk/app-framework/dist/lib/browser/chunk-CFZ5JAJF.mjs":{"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true}],"exports":["filterPlugins","findPlugin","getPlugin","resolvePlugin"],"inputs":{"packages/sdk/app-framework/src/plugins/helpers.ts":{"bytesInOutput":525}},"bytes":695}}}
|
|
1
|
+
{"inputs":{"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytes":2197,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytes":7754,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/metadata.ts":{"bytes":2058,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/translations.ts":{"bytes":3465,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/common/index.ts":{"bytes":748,"imports":[{"path":"packages/sdk/app-framework/src/plugins/common/graph.ts","kind":"import-statement","original":"./graph"},{"path":"packages/sdk/app-framework/src/plugins/common/layout.ts","kind":"import-statement","original":"./layout"},{"path":"packages/sdk/app-framework/src/plugins/common/metadata.ts","kind":"import-statement","original":"./metadata"},{"path":"packages/sdk/app-framework/src/plugins/common/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/helpers.ts":{"bytes":4017,"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/intent.ts":{"bytes":1706,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytes":1874,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytes":1616,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/index.ts":{"bytes":678,"imports":[{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/intent.ts","kind":"import-statement","original":"./intent"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx","kind":"import-statement","original":"./IntentContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts":{"bytes":5027,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytes":4312,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx":{"bytes":18413,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/local-storage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx","kind":"import-statement","original":"./PluginContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/PluginHost/index.ts":{"bytes":678,"imports":[{"path":"packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts","kind":"import-statement","original":"./plugin"},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx","kind":"import-statement","original":"./PluginContext"},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx","kind":"import-statement","original":"./PluginHost"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/helpers.ts":{"bytes":1765,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytes":1954,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx":{"bytes":4120,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx":{"bytes":2747,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytes":13254,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx","kind":"import-statement","original":"./ErrorBoundary"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx","kind":"import-statement","original":"./SurfaceRootContext"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts":{"bytes":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/index.ts":{"bytes":854,"imports":[{"path":"packages/sdk/app-framework/src/plugins/common/index.ts","kind":"import-statement","original":"./common"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"./helpers"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/index.ts","kind":"import-statement","original":"./IntentPlugin"},{"path":"packages/sdk/app-framework/src/plugins/PluginHost/index.ts","kind":"import-statement","original":"./PluginHost"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts","kind":"import-statement","original":"./SurfacePlugin"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts":{"bytes":690,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts":{"bytes":698,"imports":[],"format":"esm"},"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx":{"bytes":4010,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx","kind":"import-statement","original":"./SurfaceRootContext"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx":{"bytes":7167,"imports":[{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx","kind":"import-statement","original":"./IntentContext"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./meta"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts","kind":"import-statement","original":"./provides"},{"path":"packages/sdk/app-framework/src/plugins/helpers.ts","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/sdk/app-framework/src/App.tsx":{"bytes":6903,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts","kind":"import-statement","original":"./plugins/IntentPlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts","kind":"import-statement","original":"./plugins/SurfacePlugin/meta"},{"path":"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/SurfacePlugin/plugin"},{"path":"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx","kind":"dynamic-import","original":"./plugins/IntentPlugin/plugin"}],"format":"esm"},"packages/sdk/app-framework/src/index.ts":{"bytes":544,"imports":[{"path":"packages/sdk/app-framework/src/plugins/index.ts","kind":"import-statement","original":"./plugins"},{"path":"packages/sdk/app-framework/src/App.tsx","kind":"import-statement","original":"./App"}],"format":"esm"}},"outputs":{"packages/sdk/app-framework/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":36493},"packages/sdk/app-framework/dist/lib/browser/index.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-MNFAM2GF.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-C2K6M6WC.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-CFZ5JAJF.mjs","kind":"import-statement"},{"path":"zod","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/local-storage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"packages/sdk/app-framework/dist/lib/browser/plugin-JDIMDLDU.mjs","kind":"dynamic-import"},{"path":"packages/sdk/app-framework/dist/lib/browser/plugin-CBPJO5NB.mjs","kind":"dynamic-import"}],"exports":["ErrorBoundary","IntentProvider","Layout","LayoutAction","Plugin","PluginHost","PluginProvider","Resource","ResourceKey","ResourceLanguage","Surface","SurfaceProvider","createApp","filterPlugins","findPlugin","getPlugin","initializePlugin","isObject","parseGraphBuilderPlugin","parseGraphPlugin","parseIntentPlugin","parseIntentResolverPlugin","parseLayoutPlugin","parseMetadataRecordsPlugin","parseMetadataResolverPlugin","parsePluginHost","parseRootSurfacePlugin","parseSurfacePlugin","parseTranslationsPlugin","pluginMeta","resolvePlugin","useIntent","usePlugin","usePlugins","useResolvePlugin","useSurface"],"entryPoint":"packages/sdk/app-framework/src/index.ts","inputs":{"packages/sdk/app-framework/src/plugins/common/graph.ts":{"bytesInOutput":174},"packages/sdk/app-framework/src/plugins/common/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/common/layout.ts":{"bytesInOutput":1724},"packages/sdk/app-framework/src/plugins/common/metadata.ts":{"bytesInOutput":226},"packages/sdk/app-framework/src/plugins/common/translations.ts":{"bytesInOutput":357},"packages/sdk/app-framework/src/plugins/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/IntentPlugin/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts":{"bytesInOutput":241},"packages/sdk/app-framework/src/plugins/PluginHost/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx":{"bytesInOutput":545},"packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx":{"bytesInOutput":4479},"packages/sdk/app-framework/src/plugins/SurfacePlugin/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":676},"packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx":{"bytesInOutput":2673},"packages/sdk/app-framework/src/index.ts":{"bytesInOutput":0},"packages/sdk/app-framework/src/App.tsx":{"bytesInOutput":1151}},"bytes":14096},"packages/sdk/app-framework/dist/lib/browser/plugin-JDIMDLDU.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2039},"packages/sdk/app-framework/dist/lib/browser/plugin-JDIMDLDU.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-MNFAM2GF.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-MNFAM2GF.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3064},"packages/sdk/app-framework/dist/lib/browser/chunk-MNFAM2GF.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true}],"exports":["SurfaceProvider","meta_default","parseRootSurfacePlugin","parseSurfacePlugin","useSurface"],"inputs":{"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts":{"bytesInOutput":191},"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx":{"bytesInOutput":235},"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts":{"bytesInOutput":87}},"bytes":879},"packages/sdk/app-framework/dist/lib/browser/plugin-CBPJO5NB.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3442},"packages/sdk/app-framework/dist/lib/browser/plugin-CBPJO5NB.mjs":{"imports":[{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-C2K6M6WC.mjs","kind":"import-statement"},{"path":"packages/sdk/app-framework/dist/lib/browser/chunk-CFZ5JAJF.mjs","kind":"import-statement"},{"path":"deepsignal/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx","inputs":{"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx":{"bytesInOutput":1348}},"bytes":1672},"packages/sdk/app-framework/dist/lib/browser/chunk-C2K6M6WC.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2163},"packages/sdk/app-framework/dist/lib/browser/chunk-C2K6M6WC.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true}],"exports":["IntentProvider","meta_default","parseIntentPlugin","parseIntentResolverPlugin","useIntent"],"inputs":{"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts":{"bytesInOutput":184},"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx":{"bytesInOutput":231},"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts":{"bytesInOutput":84}},"bytes":857},"packages/sdk/app-framework/dist/lib/browser/chunk-CFZ5JAJF.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2110},"packages/sdk/app-framework/dist/lib/browser/chunk-CFZ5JAJF.mjs":{"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true}],"exports":["filterPlugins","findPlugin","getPlugin","resolvePlugin"],"inputs":{"packages/sdk/app-framework/src/plugins/helpers.ts":{"bytesInOutput":525}},"bytes":695}}}
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
SurfaceProvider,
|
|
3
3
|
meta_default,
|
|
4
4
|
parseSurfacePlugin
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-MNFAM2GF.mjs";
|
|
6
6
|
import {
|
|
7
7
|
filterPlugins
|
|
8
8
|
} from "./chunk-CFZ5JAJF.mjs";
|
|
@@ -36,4 +36,4 @@ var plugin_default = SurfacePlugin;
|
|
|
36
36
|
export {
|
|
37
37
|
plugin_default as default
|
|
38
38
|
};
|
|
39
|
-
//# sourceMappingURL=plugin-
|
|
39
|
+
//# sourceMappingURL=plugin-JDIMDLDU.mjs.map
|
|
@@ -16,15 +16,15 @@ 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
|
|
20
|
-
__export(
|
|
19
|
+
var chunk_DC3GU6QR_exports = {};
|
|
20
|
+
__export(chunk_DC3GU6QR_exports, {
|
|
21
21
|
SurfaceProvider: () => SurfaceProvider,
|
|
22
22
|
meta_default: () => meta_default,
|
|
23
23
|
parseRootSurfacePlugin: () => parseRootSurfacePlugin,
|
|
24
24
|
parseSurfacePlugin: () => parseSurfacePlugin,
|
|
25
25
|
useSurface: () => useSurface
|
|
26
26
|
});
|
|
27
|
-
module.exports = __toCommonJS(
|
|
27
|
+
module.exports = __toCommonJS(chunk_DC3GU6QR_exports);
|
|
28
28
|
var import_react = require("react");
|
|
29
29
|
var parseRootSurfacePlugin = (plugin) => plugin?.provides?.surface?.components ? plugin : void 0;
|
|
30
30
|
var parseSurfacePlugin = (plugin) => plugin?.provides?.surface?.component ? plugin : void 0;
|
|
@@ -45,4 +45,4 @@ var meta_default = SurfaceMeta;
|
|
|
45
45
|
parseSurfacePlugin,
|
|
46
46
|
useSurface
|
|
47
47
|
});
|
|
48
|
-
//# sourceMappingURL=chunk-
|
|
48
|
+
//# sourceMappingURL=chunk-DC3GU6QR.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/plugins/SurfacePlugin/provides.ts", "../../../src/plugins/SurfacePlugin/SurfaceRootContext.tsx", "../../../src/plugins/SurfacePlugin/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type SurfaceComponent, type SurfaceRootContext } from './SurfaceRootContext';\nimport { type Plugin } from '../PluginHost';\n\nexport type SurfaceProvides = {\n surface: {\n /**\n * Used by the `Surface` resolver to find a component to render.\n */\n component: SurfaceComponent;\n };\n};\n\nexport type SurfacePluginProvides = {\n surface: SurfaceRootContext;\n};\n\nexport const parseRootSurfacePlugin = (plugin?: Plugin) =>\n (plugin?.provides as any)?.surface?.components ? (plugin as Plugin<SurfacePluginProvides>) : undefined;\n\nexport const parseSurfacePlugin = (plugin?: Plugin) =>\n (plugin?.provides as any)?.surface?.component ? (plugin as Plugin<SurfaceProvides>) : undefined;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { createContext, useContext, type Context, type Provider, type ForwardedRef } from 'react';\n\nimport { type SurfaceProps } from './Surface';\n\n// TODO(wittjosiah): Factor out.\ntype WithRequiredProperty<Type, Key extends keyof Type> = Type & {\n [Property in Key]-?: Type[Property];\n};\n\ntype SurfaceComponentProps = WithRequiredProperty<SurfaceProps, 'data'>;\n\n/**\n * Determines the priority of the surface when multiple components are resolved.\n */\nexport type SurfaceDisposition = 'hoist' | 'fallback';\n\nexport type SurfaceResult = {\n node: JSX.Element;\n disposition?: SurfaceDisposition;\n};\n\n/**\n * Function which resolves a Surface.\n *\n * If a null value is returned, the rendering is deferred to other plugins.\n */\nexport type SurfaceComponent = (\n props: SurfaceComponentProps,\n forwardedRef: ForwardedRef<HTMLElement>,\n) => JSX.Element | SurfaceResult | null;\n\nexport type SurfaceRootContext = {\n components: Record<string, SurfaceComponent>;\n};\n\nconst SurfaceRootContext: Context<SurfaceRootContext> = createContext<SurfaceRootContext>({ components: {} });\n\nexport const useSurface = () => useContext(SurfaceRootContext);\n\nexport const SurfaceProvider: Provider<SurfaceRootContext> = SurfaceRootContext.Provider;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nconst SurfaceMeta = {\n id: 'dxos.org/plugin/surface',\n};\n\nexport default SurfaceMeta;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;ACIA,mBAA0F;ADgBnF,IAAMA,yBAAyB,CAACC,WACpCA,QAAQC,UAAkBC,SAASC,aAAcH,SAA2CI;AAExF,IAAMC,qBAAqB,CAACL,WAChCA,QAAQC,UAAkBC,SAASI,YAAaN,SAAqCI;ACexF,IAAMG,qBAAkDC,gDAAkC;EAAEL,YAAY,CAAC;AAAE,CAAA;AAEpG,IAAMM,aAAa,UAAMC,yBAAWH,kBAAAA;AAEpC,IAAMI,kBAAgDJ,mBAAmBK;ACvChF,IAAMC,cAAc;EAClBC,IAAI;AACN;AAEA,IAAA,eAAeD;",
|
|
6
|
+
"names": ["parseRootSurfacePlugin", "plugin", "provides", "surface", "components", "undefined", "parseSurfacePlugin", "component", "SurfaceRootContext", "createContext", "useSurface", "useContext", "SurfaceProvider", "Provider", "SurfaceMeta", "id"]
|
|
7
|
+
}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -39,12 +39,13 @@ __export(node_exports, {
|
|
|
39
39
|
ResourceKey: () => ResourceKey,
|
|
40
40
|
ResourceLanguage: () => ResourceLanguage,
|
|
41
41
|
Surface: () => Surface,
|
|
42
|
-
SurfaceProvider: () =>
|
|
42
|
+
SurfaceProvider: () => import_chunk_DC3GU6QR.SurfaceProvider,
|
|
43
43
|
createApp: () => createApp,
|
|
44
44
|
filterPlugins: () => import_chunk_VDKZ7AAF.filterPlugins,
|
|
45
45
|
findPlugin: () => import_chunk_VDKZ7AAF.findPlugin,
|
|
46
46
|
getPlugin: () => import_chunk_VDKZ7AAF.getPlugin,
|
|
47
47
|
initializePlugin: () => initializePlugin,
|
|
48
|
+
isObject: () => isObject,
|
|
48
49
|
parseGraphBuilderPlugin: () => parseGraphBuilderPlugin,
|
|
49
50
|
parseGraphPlugin: () => parseGraphPlugin,
|
|
50
51
|
parseIntentPlugin: () => import_chunk_BOQBLWMX.parseIntentPlugin,
|
|
@@ -53,8 +54,8 @@ __export(node_exports, {
|
|
|
53
54
|
parseMetadataRecordsPlugin: () => parseMetadataRecordsPlugin,
|
|
54
55
|
parseMetadataResolverPlugin: () => parseMetadataResolverPlugin,
|
|
55
56
|
parsePluginHost: () => parsePluginHost,
|
|
56
|
-
parseRootSurfacePlugin: () =>
|
|
57
|
-
parseSurfacePlugin: () =>
|
|
57
|
+
parseRootSurfacePlugin: () => import_chunk_DC3GU6QR.parseRootSurfacePlugin,
|
|
58
|
+
parseSurfacePlugin: () => import_chunk_DC3GU6QR.parseSurfacePlugin,
|
|
58
59
|
parseTranslationsPlugin: () => parseTranslationsPlugin,
|
|
59
60
|
pluginMeta: () => pluginMeta,
|
|
60
61
|
resolvePlugin: () => import_chunk_VDKZ7AAF.resolvePlugin,
|
|
@@ -62,10 +63,10 @@ __export(node_exports, {
|
|
|
62
63
|
usePlugin: () => usePlugin,
|
|
63
64
|
usePlugins: () => usePlugins,
|
|
64
65
|
useResolvePlugin: () => useResolvePlugin,
|
|
65
|
-
useSurface: () =>
|
|
66
|
+
useSurface: () => import_chunk_DC3GU6QR.useSurface
|
|
66
67
|
});
|
|
67
68
|
module.exports = __toCommonJS(node_exports);
|
|
68
|
-
var
|
|
69
|
+
var import_chunk_DC3GU6QR = require("./chunk-DC3GU6QR.cjs");
|
|
69
70
|
var import_chunk_BOQBLWMX = require("./chunk-BOQBLWMX.cjs");
|
|
70
71
|
var import_chunk_VDKZ7AAF = require("./chunk-VDKZ7AAF.cjs");
|
|
71
72
|
var import_zod = require("zod");
|
|
@@ -282,6 +283,7 @@ var compose = (contexts) => {
|
|
|
282
283
|
...contexts
|
|
283
284
|
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ import_react3.default.createElement(Acc, null, /* @__PURE__ */ import_react3.default.createElement(Next, null, children)));
|
|
284
285
|
};
|
|
286
|
+
var isObject = (data) => !!data && typeof data === "object";
|
|
285
287
|
var ErrorBoundary = class extends import_react4.Component {
|
|
286
288
|
constructor(props) {
|
|
287
289
|
super(props);
|
|
@@ -336,7 +338,7 @@ var Surface = /* @__PURE__ */ (0, import_react5.forwardRef)(({ role, name = role
|
|
|
336
338
|
});
|
|
337
339
|
var SurfaceContext = /* @__PURE__ */ (0, import_react6.createContext)(null);
|
|
338
340
|
var SurfaceResolver = /* @__PURE__ */ (0, import_react5.forwardRef)((props, forwardedRef) => {
|
|
339
|
-
const { components } = (0,
|
|
341
|
+
const { components } = (0, import_chunk_DC3GU6QR.useSurface)();
|
|
340
342
|
const parent = (0, import_react6.useContext)(SurfaceContext);
|
|
341
343
|
const nodes = resolveNodes(components, props, parent, forwardedRef);
|
|
342
344
|
const currentContext = {
|
|
@@ -360,27 +362,49 @@ var resolveNodes = (components, props, context, forwardedRef) => {
|
|
|
360
362
|
...props,
|
|
361
363
|
data
|
|
362
364
|
}, forwardedRef);
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
}
|
|
366
|
-
|
|
365
|
+
if (!result || typeof result !== "object") {
|
|
366
|
+
return void 0;
|
|
367
|
+
}
|
|
368
|
+
return "node" in result ? [
|
|
369
|
+
key,
|
|
370
|
+
result
|
|
371
|
+
] : /* @__PURE__ */ (0, import_react5.isValidElement)(result) ? [
|
|
372
|
+
key,
|
|
373
|
+
{
|
|
374
|
+
node: result
|
|
375
|
+
}
|
|
376
|
+
] : void 0;
|
|
377
|
+
}).filter((result) => Boolean(result)).sort(([, a], [, b]) => {
|
|
378
|
+
const aDisposition = a.disposition ?? "default";
|
|
379
|
+
const bDisposition = b.disposition ?? "default";
|
|
380
|
+
if (aDisposition === bDisposition) {
|
|
381
|
+
return 0;
|
|
382
|
+
} else if (aDisposition === "hoist" || bDisposition === "fallback") {
|
|
383
|
+
return -1;
|
|
384
|
+
} else if (bDisposition === "hoist" || aDisposition === "fallback") {
|
|
385
|
+
return 1;
|
|
386
|
+
}
|
|
387
|
+
return 0;
|
|
388
|
+
}).map(([key, result]) => /* @__PURE__ */ import_react5.default.createElement(import_react5.Fragment, {
|
|
389
|
+
key
|
|
390
|
+
}, result.node));
|
|
367
391
|
return props.limit ? nodes.slice(0, props.limit) : nodes;
|
|
368
392
|
};
|
|
369
393
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
|
|
370
394
|
var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }) => {
|
|
371
395
|
const host = PluginHost({
|
|
372
396
|
order: [
|
|
373
|
-
|
|
397
|
+
import_chunk_DC3GU6QR.meta_default,
|
|
374
398
|
import_chunk_BOQBLWMX.meta_default,
|
|
375
399
|
...order
|
|
376
400
|
],
|
|
377
401
|
plugins: {
|
|
378
402
|
...plugins,
|
|
379
|
-
[
|
|
403
|
+
[import_chunk_DC3GU6QR.meta_default.id]: Plugin.lazy(() => import("./plugin-JGSJGRMS.cjs")),
|
|
380
404
|
[import_chunk_BOQBLWMX.meta_default.id]: Plugin.lazy(() => import("./plugin-WDNRX2SR.cjs"))
|
|
381
405
|
},
|
|
382
406
|
core: [
|
|
383
|
-
|
|
407
|
+
import_chunk_DC3GU6QR.meta_default.id,
|
|
384
408
|
import_chunk_BOQBLWMX.meta_default.id,
|
|
385
409
|
...core
|
|
386
410
|
],
|
|
@@ -427,6 +451,7 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
427
451
|
findPlugin,
|
|
428
452
|
getPlugin,
|
|
429
453
|
initializePlugin,
|
|
454
|
+
isObject,
|
|
430
455
|
parseGraphBuilderPlugin,
|
|
431
456
|
parseGraphPlugin,
|
|
432
457
|
parseIntentPlugin,
|