@dxos/app-framework 0.3.3-main.082f8b3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/.eslintrc.js +9 -0
  2. package/.storybook/main.cjs +36 -0
  3. package/.storybook/preview-head.html +3 -0
  4. package/.storybook/preview.cjs +45 -0
  5. package/LICENSE +8 -0
  6. package/README.md +29 -0
  7. package/README.yml +5 -0
  8. package/dist/lib/browser/index.mjs +453 -0
  9. package/dist/lib/browser/index.mjs.map +7 -0
  10. package/dist/lib/browser/meta.json +1 -0
  11. package/dist/lib/node/index.cjs +522 -0
  12. package/dist/lib/node/index.cjs.map +7 -0
  13. package/dist/lib/node/meta.json +1 -0
  14. package/dist/types/src/App.d.ts +19 -0
  15. package/dist/types/src/App.d.ts.map +1 -0
  16. package/dist/types/src/index.d.ts +3 -0
  17. package/dist/types/src/index.d.ts.map +1 -0
  18. package/dist/types/src/plugins/IntentPlugin/IntentContext.d.ts +8 -0
  19. package/dist/types/src/plugins/IntentPlugin/IntentContext.d.ts.map +1 -0
  20. package/dist/types/src/plugins/IntentPlugin/IntentPlugin.d.ts +19 -0
  21. package/dist/types/src/plugins/IntentPlugin/IntentPlugin.d.ts.map +1 -0
  22. package/dist/types/src/plugins/IntentPlugin/index.d.ts +4 -0
  23. package/dist/types/src/plugins/IntentPlugin/index.d.ts.map +1 -0
  24. package/dist/types/src/plugins/IntentPlugin/intent.d.ts +28 -0
  25. package/dist/types/src/plugins/IntentPlugin/intent.d.ts.map +1 -0
  26. package/dist/types/src/plugins/PluginHost/PluginContext.d.ts +24 -0
  27. package/dist/types/src/plugins/PluginHost/PluginContext.d.ts.map +1 -0
  28. package/dist/types/src/plugins/PluginHost/PluginHost.d.ts +20 -0
  29. package/dist/types/src/plugins/PluginHost/PluginHost.d.ts.map +1 -0
  30. package/dist/types/src/plugins/PluginHost/index.d.ts +4 -0
  31. package/dist/types/src/plugins/PluginHost/index.d.ts.map +1 -0
  32. package/dist/types/src/plugins/PluginHost/plugin.d.ts +66 -0
  33. package/dist/types/src/plugins/PluginHost/plugin.d.ts.map +1 -0
  34. package/dist/types/src/plugins/PluginHost/plugin.test.d.ts +35 -0
  35. package/dist/types/src/plugins/PluginHost/plugin.test.d.ts.map +1 -0
  36. package/dist/types/src/plugins/SurfacePlugin/ErrorBoundary.d.ts +30 -0
  37. package/dist/types/src/plugins/SurfacePlugin/ErrorBoundary.d.ts.map +1 -0
  38. package/dist/types/src/plugins/SurfacePlugin/Surface.d.ts +45 -0
  39. package/dist/types/src/plugins/SurfacePlugin/Surface.d.ts.map +1 -0
  40. package/dist/types/src/plugins/SurfacePlugin/SurfacePlugin.d.ts +20 -0
  41. package/dist/types/src/plugins/SurfacePlugin/SurfacePlugin.d.ts.map +1 -0
  42. package/dist/types/src/plugins/SurfacePlugin/SurfaceRootContext.d.ts +13 -0
  43. package/dist/types/src/plugins/SurfacePlugin/SurfaceRootContext.d.ts.map +1 -0
  44. package/dist/types/src/plugins/SurfacePlugin/index.d.ts +5 -0
  45. package/dist/types/src/plugins/SurfacePlugin/index.d.ts.map +1 -0
  46. package/dist/types/src/plugins/common/graph.d.ts +26 -0
  47. package/dist/types/src/plugins/common/graph.d.ts.map +1 -0
  48. package/dist/types/src/plugins/common/index.d.ts +4 -0
  49. package/dist/types/src/plugins/common/index.d.ts.map +1 -0
  50. package/dist/types/src/plugins/common/layout.d.ts +89 -0
  51. package/dist/types/src/plugins/common/layout.d.ts.map +1 -0
  52. package/dist/types/src/plugins/common/translations.d.ts +22 -0
  53. package/dist/types/src/plugins/common/translations.d.ts.map +1 -0
  54. package/dist/types/src/plugins/helpers.d.ts +22 -0
  55. package/dist/types/src/plugins/helpers.d.ts.map +1 -0
  56. package/dist/types/src/plugins/index.d.ts +6 -0
  57. package/dist/types/src/plugins/index.d.ts.map +1 -0
  58. package/package.json +34 -0
  59. package/project.json +78 -0
  60. package/src/App.tsx +43 -0
  61. package/src/index.ts +7 -0
  62. package/src/plugins/IntentPlugin/IntentContext.tsx +17 -0
  63. package/src/plugins/IntentPlugin/IntentPlugin.tsx +69 -0
  64. package/src/plugins/IntentPlugin/index.ts +7 -0
  65. package/src/plugins/IntentPlugin/intent.ts +34 -0
  66. package/src/plugins/PluginHost/PluginContext.tsx +45 -0
  67. package/src/plugins/PluginHost/PluginHost.tsx +200 -0
  68. package/src/plugins/PluginHost/index.ts +7 -0
  69. package/src/plugins/PluginHost/plugin.test.ts +159 -0
  70. package/src/plugins/PluginHost/plugin.ts +82 -0
  71. package/src/plugins/SurfacePlugin/ErrorBoundary.tsx +45 -0
  72. package/src/plugins/SurfacePlugin/Surface.tsx +116 -0
  73. package/src/plugins/SurfacePlugin/SurfacePlugin.tsx +53 -0
  74. package/src/plugins/SurfacePlugin/SurfaceRootContext.tsx +22 -0
  75. package/src/plugins/SurfacePlugin/index.ts +8 -0
  76. package/src/plugins/common/graph.ts +33 -0
  77. package/src/plugins/common/index.ts +7 -0
  78. package/src/plugins/common/layout.ts +102 -0
  79. package/src/plugins/common/translations.ts +34 -0
  80. package/src/plugins/helpers.ts +43 -0
  81. package/src/plugins/index.ts +10 -0
  82. package/tsconfig.json +43 -0
  83. package/tsconfig.node.json +11 -0
@@ -0,0 +1,19 @@
1
+ import { type BootstrapPluginsParams } from './plugins';
2
+ /**
3
+ * Expected usage is for this to be the entrypoint of the application.
4
+ * Initializes plugins and renders the root components.
5
+ *
6
+ * @example
7
+ * const fallback = <div>Initializing Plugins...</div>;
8
+ * const App = createApp({ plugins, fallback });
9
+ * createRoot(document.getElementById('root')!).render(
10
+ * <StrictMode>
11
+ * <App />
12
+ * </StrictMode>,
13
+ * );
14
+ *
15
+ * @param params.plugins List of plugin definitions to initialize.
16
+ * @param params.fallback Fallback component to render while plugins are initializing.
17
+ */
18
+ export declare const createApp: ({ plugins, fallback }: BootstrapPluginsParams) => () => JSX.Element;
19
+ //# sourceMappingURL=App.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../src/App.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,sBAAsB,EAA2C,MAAM,WAAW,CAAC;AAEjG;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,SAAS,0BAA2B,sBAAsB,sBAgBtE,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './plugins';
2
+ export * from './App';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC;AAE1B,cAAc,OAAO,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type Provider } from 'react';
2
+ import { type DispatchIntent } from './intent';
3
+ export type IntentContext = {
4
+ dispatch: DispatchIntent;
5
+ };
6
+ export declare const useIntent: () => IntentContext;
7
+ export declare const IntentProvider: Provider<IntentContext>;
8
+ //# sourceMappingURL=IntentContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntentContext.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/IntentPlugin/IntentContext.tsx"],"names":[],"mappings":"AAIA,OAAO,EAA2C,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE/E,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,cAAc,CAAC;CAC1B,CAAC;AAIF,eAAO,MAAM,SAAS,qBAAkC,CAAC;AAEzD,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,aAAa,CAA0B,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { type IntentContext } from './IntentContext';
2
+ import { type Intent } from './intent';
3
+ import { type PluginDefinition, type Plugin } from '../PluginHost';
4
+ export type IntentResolverProvides = {
5
+ intent: {
6
+ resolver: (intent: Intent, plugins: Plugin[]) => any;
7
+ };
8
+ };
9
+ export type IntentPluginProvides = {
10
+ intent: IntentContext;
11
+ };
12
+ export declare const parseIntentPlugin: (plugin: Plugin) => Plugin<IntentPluginProvides> | undefined;
13
+ export declare const parseIntentResolverPlugin: (plugin: Plugin) => Plugin<IntentResolverProvides> | undefined;
14
+ /**
15
+ * Allows plugins to register intent handlers and routes sent intents to the appropriate plugin.
16
+ * Inspired by https://developer.android.com/reference/android/content/Intent.
17
+ */
18
+ export declare const IntentPlugin: () => PluginDefinition<IntentPluginProvides>;
19
+ //# sourceMappingURL=IntentPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntentPlugin.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/IntentPlugin/IntentPlugin.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,aAAa,EAAkB,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAGnE,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE;QACN,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,CAAC;KACtD,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,aAAa,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,iBAAiB,WAAY,MAAM,6CACkD,CAAC;AAEnG,eAAO,MAAM,yBAAyB,WAAY,MAAM,+CAC4C,CAAC;AAErG;;;GAGG;AACH,eAAO,MAAM,YAAY,QAAO,iBAAiB,oBAAoB,CAoCpE,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './intent';
2
+ export * from './IntentContext';
3
+ export * from './IntentPlugin';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/IntentPlugin/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * An intent is an abstract description of an operation to be performed.
3
+ * Intents allow actions to be performed across plugins.
4
+ */
5
+ export type Intent = {
6
+ /**
7
+ * Plugin ID.
8
+ * If specified, the intent will be sent explicitly to the plugin.
9
+ * Otherwise, the intent will be sent to all plugins, in order and the first to resolve a non-null value will be used.
10
+ */
11
+ plugin?: string;
12
+ /**
13
+ * The action to perform.
14
+ */
15
+ action: string;
16
+ /**
17
+ * Any data needed to perform the desired action.
18
+ */
19
+ data?: any;
20
+ };
21
+ /**
22
+ * Trigger one or more intents to be sent.
23
+ * If multiple intents are specified, the result of each will be merged with the data to the next.
24
+ *
25
+ * @returns The result of the last intent.
26
+ */
27
+ export type DispatchIntent = (intent: Intent | Intent[]) => Promise<any>;
28
+ //# sourceMappingURL=intent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/IntentPlugin/intent.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { type Context, type Provider } from 'react';
2
+ import { type Plugin, type PluginDefinition } from './plugin';
3
+ export type PluginContext = {
4
+ ready: boolean;
5
+ initializing: PluginDefinition[];
6
+ loading: PluginDefinition[];
7
+ plugins: Plugin[];
8
+ };
9
+ declare const PluginContext: Context<PluginContext>;
10
+ /**
11
+ * Get all plugins.
12
+ */
13
+ export declare const usePlugins: () => PluginContext;
14
+ /**
15
+ * Get a plugin by ID.
16
+ */
17
+ export declare const usePlugin: <T>(id: string) => Plugin<T> | undefined;
18
+ /**
19
+ * Resolve a plugin by predicate.
20
+ */
21
+ export declare const useResolvePlugin: <T>(predicate: (plugin: Plugin) => Plugin<T> | undefined) => Plugin<T> | undefined;
22
+ export declare const PluginProvider: Provider<PluginContext>;
23
+ export {};
24
+ //# sourceMappingURL=PluginContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PluginContext.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/PluginHost/PluginContext.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAA6B,MAAM,OAAO,CAAC;AAE/E,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAG9D,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,EAAE,gBAAgB,EAAE,CAAC;IACjC,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,QAAA,MAAM,aAAa,EAAE,OAAO,CAAC,aAAa,CAKxC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,UAAU,QAAO,aAA0C,CAAC;AAEzE;;GAEG;AACH,eAAO,MAAM,SAAS,UAAY,MAAM,0BAGvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,0BAA4B,MAAM,oDAG9D,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,aAAa,CAA0B,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { type FC, type ReactNode } from 'react';
2
+ import { type PluginContext } from './PluginContext';
3
+ import { type Plugin, type PluginDefinition } from './plugin';
4
+ export type BootstrapPluginsParams = {
5
+ plugins: PluginDefinition[];
6
+ fallback?: ReactNode | FC<Omit<PluginContext, 'ready'>>;
7
+ };
8
+ export type PluginHostProvides = {
9
+ plugins: PluginContext;
10
+ };
11
+ export declare const parsePluginHost: (plugin: Plugin) => Plugin<PluginHostProvides> | undefined;
12
+ /**
13
+ * Bootstraps an application by initializing plugins and rendering root components.
14
+ */
15
+ export declare const PluginHost: ({ plugins: definitions, fallback, }: BootstrapPluginsParams) => PluginDefinition<PluginHostProvides>;
16
+ /**
17
+ * Resolve a `PluginDefinition` into a fully initialized `Plugin`.
18
+ */
19
+ export declare const initializePlugin: <T, U>(pluginDefinition: PluginDefinition<T, U>) => Promise<Plugin<T & U>>;
20
+ //# sourceMappingURL=PluginHost.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PluginHost.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/PluginHost/PluginHost.tsx"],"names":[],"mappings":"AAKA,OAAc,EAAa,KAAK,EAAE,EAA0B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAI1F,OAAO,EAAE,KAAK,aAAa,EAAkB,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,gBAAgB,EAAuB,MAAM,UAAU,CAAC;AAEnF,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,SAAS,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;CACzD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,eAAe,WAAY,MAAM,2CACwD,CAAC;AAEvG;;GAEG;AACH,eAAO,MAAM,UAAU,wCAGpB,sBAAsB,KAAG,iBAAiB,kBAAkB,CA+D9D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,4EAS5B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './plugin';
2
+ export * from './PluginContext';
3
+ export * from './PluginHost';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/PluginHost/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
@@ -0,0 +1,66 @@
1
+ import { type FC, type PropsWithChildren } from 'react';
2
+ /**
3
+ * Capabilities provided by a plugin.
4
+ * The base surface capabilities are always included.
5
+ */
6
+ export type PluginProvides<TProvides> = TProvides & {
7
+ /**
8
+ * React Context which is wrapped around the application to enable any hooks the plugin may provide.
9
+ */
10
+ context?: FC<PropsWithChildren>;
11
+ root?: FC<PropsWithChildren>;
12
+ };
13
+ /**
14
+ * A unit of containment of modular functionality that can be provided to an application.
15
+ * Plugins provide things like components, state, actions, etc. to the application.
16
+ */
17
+ export type Plugin<TProvides = {}> = {
18
+ meta: {
19
+ /**
20
+ * Globally unique ID.
21
+ *
22
+ * Expected to be in the form of a valid URL.
23
+ *
24
+ * @example dxos.org/plugin/example
25
+ */
26
+ id: string;
27
+ /**
28
+ * Short ID for use in URLs.
29
+ *
30
+ * NOTE: This is especially experimental and likely to change.
31
+ */
32
+ shortId?: string;
33
+ };
34
+ /**
35
+ * Capabilities provided by the plugin.
36
+ */
37
+ provides: PluginProvides<TProvides>;
38
+ };
39
+ /**
40
+ * Plugin definitions extend the base `Plugin` interface with additional lifecycle methods.
41
+ */
42
+ export type PluginDefinition<TProvides = {}, TInitializeProvides = {}> = Omit<Plugin, 'provides'> & {
43
+ /**
44
+ * Capabilities provided by the plugin.
45
+ */
46
+ provides?: Plugin<TProvides>['provides'];
47
+ /**
48
+ * Initialize any async behavior required by the plugin.
49
+ *
50
+ * @return Capabilities provided by the plugin which are merged with base capabilities.
51
+ */
52
+ initialize?: () => Promise<PluginProvides<TInitializeProvides>>;
53
+ /**
54
+ * Called once all plugins have been initialized.
55
+ * This is the place to do any initialization which requires other plugins to be ready.
56
+ *
57
+ * @param plugins All plugins which successfully initialized.
58
+ */
59
+ ready?: (plugins: Plugin[]) => Promise<void>;
60
+ /**
61
+ * Called when the plugin is unloaded.
62
+ * This is the place to do any cleanup required by the plugin.
63
+ */
64
+ unload?: () => Promise<void>;
65
+ };
66
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/PluginHost/plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAExD;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,SAAS,IAAI,SAAS,GAAG;IAClD;;OAEG;IACH,OAAO,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC;IAKhC,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC;CAC9B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,MAAM,CAAC,SAAS,GAAG,EAAE,IAAI;IACnC,IAAI,EAAE;QACJ;;;;;;WAMG;QACH,EAAE,EAAE,MAAM,CAAC;QAEX;;;;WAIG;QAEH,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IAEF;;OAEG;IACH,QAAQ,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;CACrC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,SAAS,GAAG,EAAE,EAAE,mBAAmB,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG;IAClG;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;IAEzC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAEhE;;;;;OAKG;IACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { type FC } from 'react';
2
+ export interface Interface<T> {
3
+ key: string;
4
+ }
5
+ type InterfaceDef<T> = {
6
+ key: Interface<T>;
7
+ impl: T;
8
+ };
9
+ export declare const provide: <T>(key: Interface<T>, impl: T) => InterfaceDef<T>;
10
+ export type PluginProps = {
11
+ provides?: InterfaceDef<any>[];
12
+ };
13
+ export declare class TestPlugin {
14
+ readonly _interfaces: Map<string, any>;
15
+ constructor({ provides }: PluginProps);
16
+ getInterface: <T>(key: Interface<T>) => T | undefined;
17
+ }
18
+ export interface Printable {
19
+ print: (data: any | undefined) => void;
20
+ }
21
+ export declare const Printable: Interface<Printable>;
22
+ export interface Selectable {
23
+ selection: () => string | undefined;
24
+ select: (object?: {
25
+ id: string | undefined;
26
+ }) => void;
27
+ }
28
+ export declare const Selectable: Interface<Selectable>;
29
+ export type Section = FC<{
30
+ object: any;
31
+ onSelect: (object: string | undefined) => void;
32
+ }>;
33
+ export declare const Section: Interface<Section>;
34
+ export {};
35
+ //# sourceMappingURL=plugin.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.test.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/PluginHost/plugin.test.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAQhC,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,KAAK,YAAY,CAAC,CAAC,IAAI;IACrB,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAClB,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAEF,eAAO,MAAM,OAAO,oDAAsE,CAAC;AAE3F,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;CAChC,CAAC;AAEF,qBAAa,UAAU;IACrB,QAAQ,CAAC,WAAW,mBAA0B;gBAClC,EAAE,QAAQ,EAAE,EAAE,WAAW;IAIrC,YAAY,0CAA0E;CACvF;AAYD,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,CAAC,IAAI,EAAE,GAAG,GAAG,SAAS,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,SAAS,EAAE,SAAS,CAAC,SAAS,CAAwB,CAAC;AAEpE,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACpC,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,KAAK,IAAI,CAAC;CACvD;AAED,eAAO,MAAM,UAAU,EAAE,SAAS,CAAC,UAAU,CAAyB,CAAC;AAGvE,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;IAAE,MAAM,EAAE,GAAG,CAAC;IAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAA;CAAE,CAAC,CAAC;AAE1F,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,OAAO,CAAmB,CAAC"}
@@ -0,0 +1,30 @@
1
+ import React, { Component, type FC, type PropsWithChildren } from 'react';
2
+ type Props = PropsWithChildren<{
3
+ data?: any;
4
+ fallback: FC<{
5
+ error: Error;
6
+ reset: () => void;
7
+ }>;
8
+ }>;
9
+ type State = {
10
+ error: Error | undefined;
11
+ };
12
+ /**
13
+ * Surface error boundary.
14
+ *
15
+ * For basic usage prefer providing a fallback component to `Surface`.
16
+ *
17
+ * For more information on error boundaries, see:
18
+ * https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary
19
+ */
20
+ export declare class ErrorBoundary extends Component<Props, State> {
21
+ constructor(props: Props);
22
+ static getDerivedStateFromError(error: Error): {
23
+ error: Error;
24
+ };
25
+ componentDidUpdate(prevProps: Props): void;
26
+ render(): string | number | boolean | React.ReactFragment | JSX.Element | null | undefined;
27
+ private resetError;
28
+ }
29
+ export {};
30
+ //# sourceMappingURL=ErrorBoundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/SurfacePlugin/ErrorBoundary.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1E,KAAK,KAAK,GAAG,iBAAiB,CAAC;IAAE,IAAI,CAAC,EAAE,GAAG,CAAC;IAAC,QAAQ,EAAE,EAAE,CAAC;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAClG,KAAK,KAAK,GAAG;IAAE,KAAK,EAAE,KAAK,GAAG,SAAS,CAAA;CAAE,CAAC;AAE1C;;;;;;;GAOG;AACH,qBAAa,aAAc,SAAQ,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;gBAC5C,KAAK,EAAE,KAAK;IAKxB,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK;;;IAInC,kBAAkB,CAAC,SAAS,EAAE,KAAK,GAAG,IAAI;IAM1C,MAAM;IAQf,OAAO,CAAC,UAAU;CAGnB"}
@@ -0,0 +1,45 @@
1
+ import { ErrorBoundary } from './ErrorBoundary';
2
+ /**
3
+ * Direction determines how multiple components are laid out.
4
+ */
5
+ export type Direction = 'inline' | 'inline-reverse' | 'block' | 'block-reverse';
6
+ export type SurfaceProps = {
7
+ /**
8
+ * Role defines how the data should be rendered.
9
+ */
10
+ role?: string;
11
+ /**
12
+ * Names allow nested surfaces to be specified in the parent context, similar to a slot.
13
+ *
14
+ * Defaults to the value of `role` if not specified.
15
+ */
16
+ name?: string;
17
+ /**
18
+ * The data to be rendered by the surface.
19
+ */
20
+ data?: Record<string, unknown>;
21
+ /**
22
+ * Configure nested surfaces.
23
+ */
24
+ surfaces?: Record<string, Pick<SurfaceProps, 'data' | 'surfaces'>>;
25
+ /**
26
+ * If specified, the Surface will be wrapped in an error boundary.
27
+ * The fallback component will be rendered if an error occurs.
28
+ */
29
+ fallback?: ErrorBoundary['props']['fallback'];
30
+ /**
31
+ * If more than one component is resolved, the limit determines how many are rendered.
32
+ */
33
+ limit?: number | undefined;
34
+ /**
35
+ * If more than one component is resolved, the direction determines how they are laid out.
36
+ *
37
+ * NOTE: This is not yet implemented.
38
+ */
39
+ direction?: Direction;
40
+ };
41
+ /**
42
+ * A surface is a named region of the screen that can be populated by plugins.
43
+ */
44
+ export declare const Surface: ({ role, name, fallback, ...rest }: SurfaceProps) => JSX.Element;
45
+ //# sourceMappingURL=Surface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Surface.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/SurfacePlugin/Surface.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,gBAAgB,GAAG,OAAO,GAAG,eAAe,CAAC;AAEhF,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC;IAEnE;;;OAGG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC;IAE9C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE3B;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,sCAA8C,YAAY,gBAgB7E,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { type SurfaceComponent, type SurfaceRootContext } from './SurfaceRootContext';
2
+ import type { Plugin, PluginDefinition } from '../PluginHost';
3
+ export type SurfaceProvides = {
4
+ surface: {
5
+ /**
6
+ * Used by the `Surface` resolver to find a component to render.
7
+ */
8
+ component: SurfaceComponent;
9
+ };
10
+ };
11
+ export type SurfacePluginProvides = {
12
+ surface: SurfaceRootContext;
13
+ };
14
+ export declare const parseRootSurfacePlugin: (plugin?: Plugin) => Plugin<SurfacePluginProvides> | undefined;
15
+ export declare const parseSurfacePlugin: (plugin?: Plugin) => Plugin<SurfaceProvides> | undefined;
16
+ /**
17
+ * Provides a registry of surface components.
18
+ */
19
+ export declare const SurfacePlugin: () => PluginDefinition<SurfacePluginProvides>;
20
+ //# sourceMappingURL=SurfacePlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SurfacePlugin.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/SurfacePlugin/SurfacePlugin.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,gBAAgB,EAAmB,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACvG,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAG9D,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE;QACP;;WAEG;QACH,SAAS,EAAE,gBAAgB,CAAC;KAC7B,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,kBAAkB,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,sBAAsB,YAAa,MAAM,8CACkD,CAAC;AAEzG,eAAO,MAAM,kBAAkB,YAAa,MAAM,wCAC+C,CAAC;AAElG;;GAEG;AACH,eAAO,MAAM,aAAa,QAAO,iBAAiB,qBAAqB,CAmBtE,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { type Provider, type ReactNode } from 'react';
2
+ /**
3
+ * Function which resolves a Surface.
4
+ *
5
+ * If a null value is returned, the rendering is deferred to other plugins.
6
+ */
7
+ export type SurfaceComponent = (data: Record<string, unknown>, role?: string) => ReactNode;
8
+ export type SurfaceRootContext = {
9
+ components: Record<string, SurfaceComponent>;
10
+ };
11
+ export declare const useSurface: () => SurfaceRootContext;
12
+ export declare const SurfaceProvider: Provider<SurfaceRootContext>;
13
+ //# sourceMappingURL=SurfaceRootContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SurfaceRootContext.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/SurfacePlugin/SurfaceRootContext.tsx"],"names":[],"mappings":"AAIA,OAAO,EAA2C,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE/F;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,SAAS,CAAC;AAE3F,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC9C,CAAC;AAIF,eAAO,MAAM,UAAU,0BAAuC,CAAC;AAE/D,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,kBAAkB,CAA+B,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './ErrorBoundary';
2
+ export * from './Surface';
3
+ export * from './SurfacePlugin';
4
+ export * from './SurfaceRootContext';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/SurfacePlugin/index.ts"],"names":[],"mappings":"AAIA,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { Graph, Node } from '@dxos/app-graph';
2
+ import type { UnsubscribeCallback } from '@dxos/async';
3
+ import type { Plugin } from '../PluginHost';
4
+ /**
5
+ * Provides for a plugin that exposes the application graph.
6
+ */
7
+ export type GraphPluginProvides = {
8
+ graph: Graph;
9
+ };
10
+ export type GraphBuilderProvides = {
11
+ graph: {
12
+ builder: (params: {
13
+ parent: Node;
14
+ plugins: Plugin[];
15
+ }) => UnsubscribeCallback | void;
16
+ };
17
+ };
18
+ /**
19
+ * Type guard for graph plugins.
20
+ */
21
+ export declare const parseGraphPlugin: (plugin: Plugin) => Plugin<GraphPluginProvides> | undefined;
22
+ /**
23
+ * Type guard for graph builder plugins.
24
+ */
25
+ export declare const parseGraphBuilderPlugin: (plugin: Plugin) => Plugin<GraphBuilderProvides> | undefined;
26
+ //# sourceMappingURL=graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/common/graph.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE;QACL,OAAO,EAAE,CAAC,MAAM,EAAE;YAAE,MAAM,EAAE,IAAI,CAAC;YAAC,OAAO,EAAE,MAAM,EAAE,CAAA;SAAE,KAAK,mBAAmB,GAAG,IAAI,CAAC;KACtF,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,WAAY,MAAM,4CAC6C,CAAC;AAE7F;;GAEG;AACH,eAAO,MAAM,uBAAuB,WAAY,MAAM,6CAC0C,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './graph';
2
+ export * from './layout';
3
+ export * from './translations';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/common/index.ts"],"names":[],"mappings":"AAIA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,89 @@
1
+ import { z } from 'zod';
2
+ import type { Plugin } from '../PluginHost';
3
+ /**
4
+ * Basic state provided by a layout plugin.
5
+ */
6
+ export declare const Layout: z.ZodObject<{
7
+ fullscreen: z.ZodBoolean;
8
+ sidebarOpen: z.ZodBoolean;
9
+ complementarySidebarOpen: z.ZodBoolean;
10
+ dialogContent: z.ZodOptional<z.ZodAny>;
11
+ dialogOpen: z.ZodBoolean;
12
+ popoverAnchorId: z.ZodOptional<z.ZodString>;
13
+ popoverContent: z.ZodOptional<z.ZodAny>;
14
+ popoverOpen: z.ZodBoolean;
15
+ active: z.ZodOptional<z.ZodString>;
16
+ previous: z.ZodOptional<z.ZodString>;
17
+ }, "strip", z.ZodTypeAny, {
18
+ dialogContent?: any;
19
+ popoverAnchorId?: string | undefined;
20
+ popoverContent?: any;
21
+ active?: string | undefined;
22
+ previous?: string | undefined;
23
+ fullscreen: boolean;
24
+ sidebarOpen: boolean;
25
+ complementarySidebarOpen: boolean;
26
+ dialogOpen: boolean;
27
+ popoverOpen: boolean;
28
+ }, {
29
+ dialogContent?: any;
30
+ popoverAnchorId?: string | undefined;
31
+ popoverContent?: any;
32
+ active?: string | undefined;
33
+ previous?: string | undefined;
34
+ fullscreen: boolean;
35
+ sidebarOpen: boolean;
36
+ complementarySidebarOpen: boolean;
37
+ dialogOpen: boolean;
38
+ popoverOpen: boolean;
39
+ }>;
40
+ export type Layout = z.infer<typeof Layout>;
41
+ /**
42
+ * Provides for a plugin that can manage the app layout.
43
+ */
44
+ export type LayoutProvides = {
45
+ layout: Readonly<Layout>;
46
+ };
47
+ /**
48
+ * Type guard for layout plugins.
49
+ */
50
+ export declare const parseLayoutPlugin: (plugin: Plugin) => Plugin<LayoutProvides> | undefined;
51
+ export declare enum LayoutAction {
52
+ TOGGLE_FULLSCREEN = "dxos.org/plugin/intent/toggle-fullscreen",
53
+ TOGGLE_SIDEBAR = "dxos.org/plugin/intent/toggle-sidebar",
54
+ TOGGLE_COMPLEMENTARY_SIDEBAR = "dxos.org/plugin/intent/toggle-complementary-sidebar",
55
+ OPEN_DIALOG = "dxos.org/plugin/intent/open-dialog",
56
+ CLOSE_DIALOG = "dxos.org/plugin/intent/close-dialog",
57
+ OPEN_POPOVER = "dxos.org/plugin/intent/open-popover",
58
+ CLOSE_POPOVER = "dxos.org/plugin/intent/close-popover",
59
+ ACTIVATE = "dxos.org/plugin/intent/activate"
60
+ }
61
+ /**
62
+ * Expected payload for layout actions.
63
+ */
64
+ export declare namespace LayoutAction {
65
+ type ToggleFullscreen = {
66
+ state?: boolean;
67
+ };
68
+ type ToggleSidebar = {
69
+ state?: boolean;
70
+ };
71
+ type ToggleComplementarySidebar = {
72
+ state?: boolean;
73
+ };
74
+ type OpenDialog = {
75
+ component: string;
76
+ subject: any;
77
+ };
78
+ type CloseDialog = {};
79
+ type OpenPopover = {
80
+ anchorId: string;
81
+ component: string;
82
+ subject: any;
83
+ };
84
+ type ClosePopover = {};
85
+ type Activate = {
86
+ id: string;
87
+ };
88
+ }
89
+ //# sourceMappingURL=layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/common/layout.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAM5C;;GAEG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBjB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,WAAY,MAAM,uCAG/C,CAAC;AAQF,oBAAY,YAAY;IACtB,iBAAiB,6CAAuC;IACxD,cAAc,0CAAoC;IAClD,4BAA4B,wDAAkD;IAC9E,WAAW,uCAAiC;IAC5C,YAAY,wCAAkC;IAC9C,YAAY,wCAAkC;IAC9C,aAAa,yCAAmC;IAChD,QAAQ,oCAA8B;CACvC;AAED;;GAEG;AACH,yBAAiB,YAAY,CAAC;IAC5B,KAAY,gBAAgB,GAAG;QAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC;IAEF,KAAY,aAAa,GAAG;QAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC;IAEF,KAAY,0BAA0B,GAAG;QACvC,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC;IAEF,KAAY,UAAU,GAAG;QACvB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,GAAG,CAAC;KACd,CAAC;IAEF,KAAY,WAAW,GAAG,EAAE,CAAC;IAE7B,KAAY,WAAW,GAAG;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,GAAG,CAAC;KACd,CAAC;IAEF,KAAY,YAAY,GAAG,EAAE,CAAC;IAE9B,KAAY,QAAQ,GAAG;QACrB,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;CACH"}
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ import type { Plugin } from '../PluginHost';
3
+ export declare const ResourceKey: z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>;
4
+ export type ResourceKey = z.infer<typeof ResourceKey>;
5
+ export declare const ResourceLanguage: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>;
6
+ export type ResourceLanguage = z.infer<typeof ResourceLanguage>;
7
+ /**
8
+ * A resource is a collection of translations for a language.
9
+ */
10
+ export declare const Resource: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>>;
11
+ export type Resource = z.infer<typeof Resource>;
12
+ /**
13
+ * Provides for a plugin that exposes translations.
14
+ */
15
+ export type TranslationsProvides = {
16
+ translations: Readonly<Resource[]>;
17
+ };
18
+ /**
19
+ * Type guard for translation plugins.
20
+ */
21
+ export declare const parseTranslationsPlugin: (plugin: Plugin) => Plugin<TranslationsProvides> | undefined;
22
+ //# sourceMappingURL=translations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/common/translations.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,eAAO,MAAM,WAAW,+DAA2C,CAAC;AACpE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,eAAO,MAAM,gBAAgB,yFAAwB,CAAC;AACtD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,QAAQ,mHAA6B,CAAC;AACnD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,YAAY,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;CACpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,WAAY,MAAM,6CAGrD,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { type Plugin } from './PluginHost';
2
+ /**
3
+ * Find a plugin by ID.
4
+ */
5
+ export declare const findPlugin: <T>(plugins: Plugin[], id: string) => Plugin<T> | undefined;
6
+ /**
7
+ * Find a plugin by ID, or raise an error if not found.
8
+ */
9
+ export declare const getPlugin: <T>(plugins: Plugin[], id: string) => Plugin<T>;
10
+ /**
11
+ * Filter a list of plugins to only those that match a predicate.
12
+ */
13
+ export declare const filterPlugins: <T>(plugins: Plugin[], predicate: (plugin: Plugin) => Plugin<T> | undefined) => Plugin<T>[];
14
+ /**
15
+ * Resolves a plugin by predicate.
16
+ *
17
+ * @example
18
+ * import { parseIntentPlugin, resolvePlugin } from '@dxos/app-framework';
19
+ * const intentPlugin = resolvePlugin(plugins, parseIntentPlugin);
20
+ */
21
+ export declare const resolvePlugin: <T>(plugins: Plugin[], predicate: (plugin: Plugin) => Plugin<T> | undefined) => Plugin<T> | undefined;
22
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/plugins/helpers.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,UAAU,eAAgB,MAAM,EAAE,MAAM,MAAM,0BAI1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,eAAgB,MAAM,EAAE,MAAM,MAAM,cAEzD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,eACf,MAAM,EAAE,sBACG,MAAM,0CACkF,CAAC;AAE/G;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,eACf,MAAM,EAAE,sBACG,MAAM,oDACoC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './common';
2
+ export * from './helpers';
3
+ export * from './IntentPlugin';
4
+ export * from './PluginHost';
5
+ export * from './SurfacePlugin';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAE1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC"}