@dxos/app-framework 0.3.10-next.ef70620 → 0.3.11-main.bd26370

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.
@@ -13,17 +13,19 @@ import type { Plugin } from '../PluginHost';
13
13
  /**
14
14
  * Basic state provided by a layout plugin.
15
15
  */
16
+ // TODO(burdon): Josiah: why do we use zod here?
16
17
  export const Layout = z.object({
17
18
  fullscreen: z.boolean(),
18
19
  sidebarOpen: z.boolean(),
19
20
  complementarySidebarOpen: z.boolean(),
20
21
 
21
- dialogContent: z.any().optional().describe('Data to be passed to the dialog Surface.'),
22
+ // TODO(burdon): Why do we have a single root?
22
23
  dialogOpen: z.boolean(),
24
+ dialogContent: z.any().optional().describe('Data to be passed to the dialog Surface.'),
23
25
 
24
- popoverAnchorId: z.string().optional(),
25
- popoverContent: z.any().optional().describe('Data to be passed to the popover Surface.'),
26
26
  popoverOpen: z.boolean(),
27
+ popoverContent: z.any().optional().describe('Data to be passed to the popover Surface.'),
28
+ popoverAnchorId: z.string().optional(),
27
29
 
28
30
  // TODO(wittjosiah): Array?
29
31
  active: z.string().optional().describe('Id of the currently active item.'),
@@ -52,7 +54,7 @@ export const parseLayoutPlugin = (plugin: Plugin) => {
52
54
  // Intents
53
55
  //
54
56
 
55
- const LAYOUT_ACTION = 'dxos.org/plugin/intent';
57
+ const LAYOUT_ACTION = 'dxos.org/plugin/layout';
56
58
  // TODO(wittjosiah): Consider consolidating some action types (e.g. toggle).
57
59
  export enum LayoutAction {
58
60
  TOGGLE_FULLSCREEN = `${LAYOUT_ACTION}/toggle-fullscreen`,
@@ -0,0 +1,22 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { type Plugin } from '../PluginHost';
6
+
7
+ // TODO(burdon): Plugins should export ts-effect object (see local-storage).
8
+ // TODO(burdon): Auto generate form.
9
+ // TODO(burdon): Set surface's data.type to plugin id (allow custom settings surface).
10
+
11
+ export type SettingsProvides<T extends Record<string, any> = Record<string, any>> = {
12
+ settings: T; // TODO(burdon): Read-only.
13
+ };
14
+
15
+ export const parseSettingsPlugin = (plugin: Plugin) => {
16
+ return typeof (plugin.provides as any).settings === 'object' ? (plugin as Plugin<SettingsProvides>) : undefined;
17
+ };
18
+
19
+ const SETTINGS_ACTION = 'dxos.org/plugin/settings';
20
+ export enum SettingsAction {
21
+ OPEN = `${SETTINGS_ACTION}/open`,
22
+ }