@dxos/app-framework 0.6.12-main.15a606f → 0.6.12-main.2d19bf1

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 (31) hide show
  1. package/dist/lib/browser/index.mjs +169 -163
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node/index.cjs +183 -182
  5. package/dist/lib/node/index.cjs.map +4 -4
  6. package/dist/lib/node/meta.json +1 -1
  7. package/dist/lib/node-esm/index.mjs +169 -163
  8. package/dist/lib/node-esm/index.mjs.map +4 -4
  9. package/dist/lib/node-esm/meta.json +1 -1
  10. package/dist/types/src/App.d.ts +4 -4
  11. package/dist/types/src/App.d.ts.map +1 -1
  12. package/dist/types/src/plugins/PluginHost/PluginContainer.d.ts +14 -0
  13. package/dist/types/src/plugins/PluginHost/PluginContainer.d.ts.map +1 -0
  14. package/dist/types/src/plugins/PluginHost/PluginContext.d.ts +4 -4
  15. package/dist/types/src/plugins/PluginHost/PluginContext.d.ts.map +1 -1
  16. package/dist/types/src/plugins/PluginHost/PluginHost.d.ts +4 -8
  17. package/dist/types/src/plugins/PluginHost/PluginHost.d.ts.map +1 -1
  18. package/dist/types/src/plugins/PluginHost/plugin.d.ts +37 -72
  19. package/dist/types/src/plugins/PluginHost/plugin.d.ts.map +1 -1
  20. package/dist/types/src/plugins/common/navigation.d.ts +1 -12
  21. package/dist/types/src/plugins/common/navigation.d.ts.map +1 -1
  22. package/package.json +12 -10
  23. package/project.json +2 -1
  24. package/src/App.tsx +10 -9
  25. package/src/plugins/PluginHost/PluginContainer.tsx +120 -0
  26. package/src/plugins/PluginHost/PluginContext.tsx +8 -14
  27. package/src/plugins/PluginHost/PluginHost.tsx +18 -121
  28. package/src/plugins/PluginHost/plugin.ts +45 -45
  29. package/src/plugins/common/navigation.ts +4 -11
  30. package/tsconfig.json +1 -29
  31. package/vitest.config.ts +1 -1
@@ -20,54 +20,56 @@ export type PluginProvides<TProvides> = TProvides & {
20
20
  root?: FC<PropsWithChildren>;
21
21
  };
22
22
 
23
+ export type PluginMeta = {
24
+ /**
25
+ * Globally unique ID.
26
+ *
27
+ * Expected to be in the form of a valid URL.
28
+ *
29
+ * @example dxos.org/plugin/example
30
+ */
31
+ id: string;
32
+
33
+ /**
34
+ * Short ID for use in URLs.
35
+ *
36
+ * NOTE: This is especially experimental and likely to change.
37
+ */
38
+ // TODO(wittjosiah): How should these be managed?
39
+ shortId?: string;
40
+
41
+ /**
42
+ * Human-readable name.
43
+ */
44
+ name?: string;
45
+
46
+ /**
47
+ * Short description of plugin functionality.
48
+ */
49
+ description?: string;
50
+
51
+ /**
52
+ * URL of home page.
53
+ */
54
+ homePage?: string;
55
+
56
+ /**
57
+ * Tags to help categorize the plugin.
58
+ */
59
+ tags?: string[];
60
+
61
+ /**
62
+ * A grep-able symbol string which can be resolved to an icon asset by @ch-ui/icons, via @ch-ui/vite-plugin-icons.
63
+ */
64
+ icon?: string;
65
+ };
66
+
23
67
  /**
24
68
  * A unit of containment of modular functionality that can be provided to an application.
25
69
  * Plugins provide things like components, state, actions, etc. to the application.
26
70
  */
27
71
  export type Plugin<TProvides = {}> = {
28
- meta: {
29
- /**
30
- * Globally unique ID.
31
- *
32
- * Expected to be in the form of a valid URL.
33
- *
34
- * @example dxos.org/plugin/example
35
- */
36
- id: string;
37
-
38
- /**
39
- * Short ID for use in URLs.
40
- *
41
- * NOTE: This is especially experimental and likely to change.
42
- */
43
- // TODO(wittjosiah): How should these be managed?
44
- shortId?: string;
45
-
46
- /**
47
- * Human-readable name.
48
- */
49
- name?: string;
50
-
51
- /**
52
- * Short description of plugin functionality.
53
- */
54
- description?: string;
55
-
56
- /**
57
- * URL of home page.
58
- */
59
- homePage?: string;
60
-
61
- /**
62
- * Tags to help categorize the plugin.
63
- */
64
- tags?: string[];
65
-
66
- /**
67
- * A grep-able symbol string which can be resolved to an icon asset by @ch-ui/icons, via @ch-ui/vite-plugin-icons.
68
- */
69
- icon?: string;
70
- };
72
+ meta: PluginMeta;
71
73
 
72
74
  /**
73
75
  * Capabilities provided by the plugin.
@@ -107,8 +109,6 @@ export type PluginDefinition<TProvides = {}, TInitializeProvides = {}> = Omit<Pl
107
109
  unload?: () => Promise<void>;
108
110
  };
109
111
 
110
- export const pluginMeta = (meta: Plugin['meta']) => meta;
111
-
112
112
  type LazyPlugin<T> = () => Promise<{ default: (props: T) => PluginDefinition }>;
113
113
 
114
114
  export namespace Plugin {
@@ -2,10 +2,9 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
+ import { Schema as S } from '@effect/schema';
5
6
  import { z } from 'zod';
6
7
 
7
- import { S } from '@dxos/echo-schema';
8
-
9
8
  import type { IntentData } from '../IntentPlugin';
10
9
  import type { Plugin } from '../PluginHost';
11
10
 
@@ -30,7 +29,9 @@ const LayoutPartSchema = S.Union(
30
29
  );
31
30
  export type LayoutPart = S.Schema.Type<typeof LayoutPartSchema>;
32
31
 
33
- const LayoutPartsSchema = S.partial(S.mutable(S.Record(LayoutPartSchema, S.mutable(S.Array(LayoutEntrySchema)))));
32
+ const LayoutPartsSchema = S.partial(
33
+ S.mutable(S.Record({ key: LayoutPartSchema, value: S.mutable(S.Array(LayoutEntrySchema)) })),
34
+ );
34
35
  export type LayoutParts = S.Schema.Type<typeof LayoutPartsSchema>;
35
36
 
36
37
  const LayoutCoordinateSchema = S.mutable(S.Struct({ part: LayoutPartSchema, entryId: S.String }));
@@ -51,14 +52,6 @@ export type ActiveParts = z.infer<typeof ActiveParts>;
51
52
  // TODO(burdon): Where should this go?
52
53
  export type LayoutContainerProps<T> = T & { role?: string; coordinate?: LayoutCoordinate };
53
54
 
54
- /**
55
- * Basic state provided by a navigation plugin.
56
- */
57
- export const Attention = z.object({
58
- attended: z.set(z.string()).describe('Ids of items which have focus.'),
59
- });
60
- export type Attention = z.infer<typeof Attention>;
61
-
62
55
  /**
63
56
  * Provides for a plugin that can manage the app navigation.
64
57
  */
package/tsconfig.json CHANGED
@@ -16,35 +16,7 @@
16
16
  "include": [
17
17
  "src"
18
18
  ],
19
- "references": [
20
- {
21
- "path": "../../common/async"
22
- },
23
- {
24
- "path": "../../common/debug"
25
- },
26
- {
27
- "path": "../../common/invariant"
28
- },
29
- {
30
- "path": "../../common/local-storage"
31
- },
32
- {
33
- "path": "../../common/log"
34
- },
35
- {
36
- "path": "../../common/util"
37
- },
38
- {
39
- "path": "../../core/echo/echo-schema"
40
- },
41
- {
42
- "path": "../app-graph"
43
- },
44
- {
45
- "path": "../client-protocol"
46
- }
47
- ],
19
+ "references": [],
48
20
  "ts-node": {
49
21
  "compilerOptions": {
50
22
  "module": "CommonJS"
package/vitest.config.ts CHANGED
@@ -6,4 +6,4 @@ import { defineConfig, mergeConfig } from 'vitest/config';
6
6
 
7
7
  import { baseConfig } from '../../../vitest.shared';
8
8
 
9
- export default mergeConfig(baseConfig(), defineConfig({}));
9
+ export default mergeConfig(baseConfig({ cwd: __dirname }), defineConfig({}));