@dxos/app-framework 0.6.13 → 0.6.14-main.69511f5

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 (204) hide show
  1. package/dist/lib/browser/chunk-3E7RY3CE.mjs +72 -0
  2. package/dist/lib/browser/chunk-3E7RY3CE.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-653Y45CL.mjs +41 -0
  4. package/dist/lib/browser/chunk-653Y45CL.mjs.map +7 -0
  5. package/dist/lib/browser/{plugin-MM66VRCO.mjs → chunk-CDLQO5K2.mjs} +66 -20
  6. package/dist/lib/browser/chunk-CDLQO5K2.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-EQTQGGE6.mjs +214 -0
  8. package/dist/lib/browser/chunk-EQTQGGE6.mjs.map +7 -0
  9. package/dist/lib/browser/index.mjs +183 -293
  10. package/dist/lib/browser/index.mjs.map +4 -4
  11. package/dist/lib/browser/meta.json +1 -1
  12. package/dist/lib/browser/plugin-intent-Q5KFPKFA.mjs +22 -0
  13. package/dist/lib/browser/plugin-intent-Q5KFPKFA.mjs.map +7 -0
  14. package/dist/lib/browser/plugin-settings-OM3G2QFY.mjs +11 -0
  15. package/dist/lib/browser/plugin-settings-OM3G2QFY.mjs.map +7 -0
  16. package/dist/lib/browser/plugin-surface-ZQXFAL46.mjs +24 -0
  17. package/dist/lib/browser/plugin-surface-ZQXFAL46.mjs.map +7 -0
  18. package/dist/lib/node/chunk-EF67TRWJ.cjs +236 -0
  19. package/dist/lib/node/chunk-EF67TRWJ.cjs.map +7 -0
  20. package/dist/lib/node/chunk-JZ2JVKRY.cjs +58 -0
  21. package/dist/lib/node/chunk-JZ2JVKRY.cjs.map +7 -0
  22. package/dist/lib/node/{chunk-62W6CMGM.cjs → chunk-QBM42OQ6.cjs} +56 -5
  23. package/dist/lib/node/chunk-QBM42OQ6.cjs.map +7 -0
  24. package/dist/lib/node/{plugin-QV7ESETI.cjs → chunk-VOKMWTKO.cjs} +74 -20
  25. package/dist/lib/node/chunk-VOKMWTKO.cjs.map +7 -0
  26. package/dist/lib/node/index.cjs +195 -310
  27. package/dist/lib/node/index.cjs.map +4 -4
  28. package/dist/lib/node/meta.json +1 -1
  29. package/dist/lib/node/plugin-intent-FMC4SDI3.cjs +43 -0
  30. package/dist/lib/node/plugin-intent-FMC4SDI3.cjs.map +7 -0
  31. package/dist/lib/node/plugin-settings-OZ6IKAE5.cjs +32 -0
  32. package/dist/lib/node/plugin-settings-OZ6IKAE5.cjs.map +7 -0
  33. package/dist/lib/node/{chunk-P5GRB4XF.cjs → plugin-surface-B5NHOBSW.cjs} +19 -22
  34. package/dist/lib/node/plugin-surface-B5NHOBSW.cjs.map +7 -0
  35. package/dist/lib/node-esm/chunk-3FCLBEOX.mjs +215 -0
  36. package/dist/lib/node-esm/chunk-3FCLBEOX.mjs.map +7 -0
  37. package/dist/lib/node-esm/chunk-EYCTSFEJ.mjs +74 -0
  38. package/dist/lib/node-esm/chunk-EYCTSFEJ.mjs.map +7 -0
  39. package/dist/lib/node-esm/chunk-MYNXI5VG.mjs +214 -0
  40. package/dist/lib/node-esm/chunk-MYNXI5VG.mjs.map +7 -0
  41. package/dist/lib/node-esm/chunk-YNU7FTGJ.mjs +43 -0
  42. package/dist/lib/node-esm/chunk-YNU7FTGJ.mjs.map +7 -0
  43. package/dist/lib/node-esm/index.mjs +567 -0
  44. package/dist/lib/node-esm/index.mjs.map +7 -0
  45. package/dist/lib/node-esm/meta.json +1 -0
  46. package/dist/lib/node-esm/plugin-intent-KETLP7UL.mjs +23 -0
  47. package/dist/lib/node-esm/plugin-intent-KETLP7UL.mjs.map +7 -0
  48. package/dist/lib/node-esm/plugin-settings-37UVWF2V.mjs +12 -0
  49. package/dist/lib/node-esm/plugin-settings-37UVWF2V.mjs.map +7 -0
  50. package/dist/lib/node-esm/plugin-surface-QXQRR534.mjs +25 -0
  51. package/dist/lib/node-esm/plugin-surface-QXQRR534.mjs.map +7 -0
  52. package/dist/types/src/App.d.ts +5 -5
  53. package/dist/types/src/App.d.ts.map +1 -1
  54. package/dist/types/src/plugins/common/file.d.ts +1 -1
  55. package/dist/types/src/plugins/common/file.d.ts.map +1 -1
  56. package/dist/types/src/plugins/common/graph.d.ts +1 -1
  57. package/dist/types/src/plugins/common/graph.d.ts.map +1 -1
  58. package/dist/types/src/plugins/common/index.d.ts +0 -1
  59. package/dist/types/src/plugins/common/index.d.ts.map +1 -1
  60. package/dist/types/src/plugins/common/layout.d.ts +6 -6
  61. package/dist/types/src/plugins/common/layout.d.ts.map +1 -1
  62. package/dist/types/src/plugins/common/metadata.d.ts +1 -1
  63. package/dist/types/src/plugins/common/metadata.d.ts.map +1 -1
  64. package/dist/types/src/plugins/common/navigation.d.ts +9 -20
  65. package/dist/types/src/plugins/common/navigation.d.ts.map +1 -1
  66. package/dist/types/src/plugins/common/translations.d.ts +1 -1
  67. package/dist/types/src/plugins/common/translations.d.ts.map +1 -1
  68. package/dist/types/src/plugins/helpers.d.ts +20 -5
  69. package/dist/types/src/plugins/helpers.d.ts.map +1 -1
  70. package/dist/types/src/plugins/index.d.ts +4 -3
  71. package/dist/types/src/plugins/index.d.ts.map +1 -1
  72. package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts +21 -0
  73. package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts.map +1 -0
  74. package/dist/types/src/plugins/plugin-host/PluginContainer.d.ts +14 -0
  75. package/dist/types/src/plugins/plugin-host/PluginContainer.d.ts.map +1 -0
  76. package/dist/types/src/plugins/{PluginHost → plugin-host}/PluginContext.d.ts +4 -4
  77. package/dist/types/src/plugins/plugin-host/PluginContext.d.ts.map +1 -0
  78. package/dist/types/src/plugins/plugin-host/index.d.ts +4 -0
  79. package/dist/types/src/plugins/plugin-host/index.d.ts.map +1 -0
  80. package/dist/types/src/plugins/{PluginHost → plugin-host}/plugin.d.ts +37 -83
  81. package/dist/types/src/plugins/plugin-host/plugin.d.ts.map +1 -0
  82. package/dist/types/src/plugins/plugin-host/plugin.test.d.ts.map +1 -0
  83. package/dist/types/src/plugins/plugin-intent/IntentContext.d.ts.map +1 -0
  84. package/dist/types/src/plugins/{IntentPlugin/plugin.d.ts → plugin-intent/IntentPlugin.d.ts} +3 -4
  85. package/dist/types/src/plugins/plugin-intent/IntentPlugin.d.ts.map +1 -0
  86. package/dist/types/src/plugins/plugin-intent/helpers.d.ts.map +1 -0
  87. package/dist/types/src/plugins/plugin-intent/index.d.ts +6 -0
  88. package/dist/types/src/plugins/plugin-intent/index.d.ts.map +1 -0
  89. package/dist/types/src/plugins/{IntentPlugin → plugin-intent}/intent.d.ts +1 -1
  90. package/dist/types/src/plugins/plugin-intent/intent.d.ts.map +1 -0
  91. package/dist/types/src/plugins/plugin-intent/meta.d.ts.map +1 -0
  92. package/dist/types/src/plugins/{IntentPlugin → plugin-intent}/provides.d.ts +2 -2
  93. package/dist/types/src/plugins/plugin-intent/provides.d.ts.map +1 -0
  94. package/dist/types/src/plugins/plugin-settings/SettingsPlugin.d.ts +4 -0
  95. package/dist/types/src/plugins/plugin-settings/SettingsPlugin.d.ts.map +1 -0
  96. package/dist/types/src/plugins/plugin-settings/index.d.ts +4 -0
  97. package/dist/types/src/plugins/plugin-settings/index.d.ts.map +1 -0
  98. package/dist/types/src/plugins/plugin-settings/meta.d.ts +5 -0
  99. package/dist/types/src/plugins/plugin-settings/meta.d.ts.map +1 -0
  100. package/dist/types/src/plugins/plugin-settings/provides.d.ts +13 -0
  101. package/dist/types/src/plugins/plugin-settings/provides.d.ts.map +1 -0
  102. package/dist/types/src/plugins/plugin-surface/ErrorBoundary.d.ts.map +1 -0
  103. package/dist/types/src/plugins/{SurfacePlugin → plugin-surface}/Surface.d.ts +6 -2
  104. package/dist/types/src/plugins/plugin-surface/Surface.d.ts.map +1 -0
  105. package/dist/types/src/plugins/plugin-surface/SurfacePlugin.d.ts +7 -0
  106. package/dist/types/src/plugins/plugin-surface/SurfacePlugin.d.ts.map +1 -0
  107. package/dist/types/src/plugins/{SurfacePlugin → plugin-surface}/SurfaceRootContext.d.ts +15 -2
  108. package/dist/types/src/plugins/plugin-surface/SurfaceRootContext.d.ts.map +1 -0
  109. package/dist/types/src/plugins/plugin-surface/helpers.d.ts.map +1 -0
  110. package/dist/types/src/plugins/{SurfacePlugin → plugin-surface}/index.d.ts +2 -0
  111. package/dist/types/src/plugins/plugin-surface/index.d.ts.map +1 -0
  112. package/dist/types/src/plugins/plugin-surface/meta.d.ts.map +1 -0
  113. package/dist/types/src/plugins/{SurfacePlugin → plugin-surface}/provides.d.ts +1 -1
  114. package/dist/types/src/plugins/plugin-surface/provides.d.ts.map +1 -0
  115. package/package.json +16 -14
  116. package/project.json +3 -8
  117. package/src/App.tsx +18 -16
  118. package/src/plugins/common/file.ts +1 -1
  119. package/src/plugins/common/graph.ts +1 -1
  120. package/src/plugins/common/index.ts +0 -1
  121. package/src/plugins/common/layout.ts +6 -3
  122. package/src/plugins/common/metadata.ts +1 -1
  123. package/src/plugins/common/navigation.ts +10 -15
  124. package/src/plugins/common/translations.ts +2 -8
  125. package/src/plugins/helpers.ts +55 -11
  126. package/src/plugins/index.ts +4 -3
  127. package/src/plugins/plugin-host/HostPlugin.tsx +96 -0
  128. package/src/plugins/plugin-host/PluginContainer.tsx +120 -0
  129. package/src/plugins/{PluginHost → plugin-host}/PluginContext.tsx +9 -14
  130. package/src/plugins/{PluginHost → plugin-host}/index.ts +2 -1
  131. package/src/plugins/{PluginHost → plugin-host}/plugin.test.ts +1 -2
  132. package/src/plugins/{PluginHost → plugin-host}/plugin.ts +45 -52
  133. package/src/plugins/{IntentPlugin/plugin.tsx → plugin-intent/IntentPlugin.tsx} +3 -6
  134. package/src/plugins/{IntentPlugin → plugin-intent}/index.ts +4 -0
  135. package/src/plugins/{IntentPlugin → plugin-intent}/intent.ts +1 -1
  136. package/src/plugins/{IntentPlugin → plugin-intent}/provides.ts +5 -2
  137. package/src/plugins/plugin-settings/SettingsPlugin.tsx +22 -0
  138. package/src/plugins/plugin-settings/index.ts +9 -0
  139. package/src/plugins/plugin-settings/meta.ts +9 -0
  140. package/src/plugins/plugin-settings/provides.ts +29 -0
  141. package/src/plugins/{SurfacePlugin → plugin-surface}/Surface.tsx +74 -40
  142. package/src/plugins/{SurfacePlugin/plugin.tsx → plugin-surface/SurfacePlugin.tsx} +3 -5
  143. package/src/plugins/{SurfacePlugin → plugin-surface}/SurfaceRootContext.tsx +21 -4
  144. package/src/plugins/{SurfacePlugin → plugin-surface}/index.ts +4 -0
  145. package/src/plugins/{SurfacePlugin → plugin-surface}/provides.ts +2 -1
  146. package/tsconfig.json +2 -30
  147. package/vitest.config.ts +9 -0
  148. package/dist/lib/browser/chunk-J45KR4DI.mjs +0 -52
  149. package/dist/lib/browser/chunk-J45KR4DI.mjs.map +0 -7
  150. package/dist/lib/browser/chunk-S5CI6EUQ.mjs +0 -20
  151. package/dist/lib/browser/chunk-S5CI6EUQ.mjs.map +0 -7
  152. package/dist/lib/browser/chunk-YYV26N3W.mjs +0 -26
  153. package/dist/lib/browser/chunk-YYV26N3W.mjs.map +0 -7
  154. package/dist/lib/browser/plugin-K3KCPCTJ.mjs +0 -39
  155. package/dist/lib/browser/plugin-K3KCPCTJ.mjs.map +0 -7
  156. package/dist/lib/browser/plugin-MM66VRCO.mjs.map +0 -7
  157. package/dist/lib/node/chunk-62W6CMGM.cjs.map +0 -7
  158. package/dist/lib/node/chunk-DFST5IG5.cjs +0 -77
  159. package/dist/lib/node/chunk-DFST5IG5.cjs.map +0 -7
  160. package/dist/lib/node/chunk-P5GRB4XF.cjs.map +0 -7
  161. package/dist/lib/node/plugin-QV7ESETI.cjs.map +0 -7
  162. package/dist/lib/node/plugin-RUJ5PEXB.cjs +0 -61
  163. package/dist/lib/node/plugin-RUJ5PEXB.cjs.map +0 -7
  164. package/dist/types/src/plugins/IntentPlugin/IntentContext.d.ts.map +0 -1
  165. package/dist/types/src/plugins/IntentPlugin/helpers.d.ts.map +0 -1
  166. package/dist/types/src/plugins/IntentPlugin/index.d.ts +0 -4
  167. package/dist/types/src/plugins/IntentPlugin/index.d.ts.map +0 -1
  168. package/dist/types/src/plugins/IntentPlugin/intent.d.ts.map +0 -1
  169. package/dist/types/src/plugins/IntentPlugin/meta.d.ts.map +0 -1
  170. package/dist/types/src/plugins/IntentPlugin/plugin.d.ts.map +0 -1
  171. package/dist/types/src/plugins/IntentPlugin/provides.d.ts.map +0 -1
  172. package/dist/types/src/plugins/PluginHost/PluginContext.d.ts.map +0 -1
  173. package/dist/types/src/plugins/PluginHost/PluginHost.d.ts +0 -25
  174. package/dist/types/src/plugins/PluginHost/PluginHost.d.ts.map +0 -1
  175. package/dist/types/src/plugins/PluginHost/index.d.ts +0 -4
  176. package/dist/types/src/plugins/PluginHost/index.d.ts.map +0 -1
  177. package/dist/types/src/plugins/PluginHost/plugin.d.ts.map +0 -1
  178. package/dist/types/src/plugins/PluginHost/plugin.test.d.ts.map +0 -1
  179. package/dist/types/src/plugins/SurfacePlugin/ErrorBoundary.d.ts.map +0 -1
  180. package/dist/types/src/plugins/SurfacePlugin/Surface.d.ts.map +0 -1
  181. package/dist/types/src/plugins/SurfacePlugin/SurfaceRootContext.d.ts.map +0 -1
  182. package/dist/types/src/plugins/SurfacePlugin/helpers.d.ts.map +0 -1
  183. package/dist/types/src/plugins/SurfacePlugin/index.d.ts.map +0 -1
  184. package/dist/types/src/plugins/SurfacePlugin/meta.d.ts.map +0 -1
  185. package/dist/types/src/plugins/SurfacePlugin/plugin.d.ts +0 -8
  186. package/dist/types/src/plugins/SurfacePlugin/plugin.d.ts.map +0 -1
  187. package/dist/types/src/plugins/SurfacePlugin/provides.d.ts.map +0 -1
  188. package/dist/types/src/plugins/common/settings.d.ts +0 -9
  189. package/dist/types/src/plugins/common/settings.d.ts.map +0 -1
  190. package/src/plugins/PluginHost/PluginHost.tsx +0 -198
  191. package/src/plugins/common/settings.ts +0 -22
  192. /package/dist/types/src/plugins/{PluginHost → plugin-host}/plugin.test.d.ts +0 -0
  193. /package/dist/types/src/plugins/{IntentPlugin → plugin-intent}/IntentContext.d.ts +0 -0
  194. /package/dist/types/src/plugins/{IntentPlugin → plugin-intent}/helpers.d.ts +0 -0
  195. /package/dist/types/src/plugins/{IntentPlugin → plugin-intent}/meta.d.ts +0 -0
  196. /package/dist/types/src/plugins/{SurfacePlugin → plugin-surface}/ErrorBoundary.d.ts +0 -0
  197. /package/dist/types/src/plugins/{SurfacePlugin → plugin-surface}/helpers.d.ts +0 -0
  198. /package/dist/types/src/plugins/{SurfacePlugin → plugin-surface}/meta.d.ts +0 -0
  199. /package/src/plugins/{IntentPlugin → plugin-intent}/IntentContext.tsx +0 -0
  200. /package/src/plugins/{IntentPlugin → plugin-intent}/helpers.ts +0 -0
  201. /package/src/plugins/{IntentPlugin → plugin-intent}/meta.ts +0 -0
  202. /package/src/plugins/{SurfacePlugin → plugin-surface}/ErrorBoundary.tsx +0 -0
  203. /package/src/plugins/{SurfacePlugin → plugin-surface}/helpers.ts +0 -0
  204. /package/src/plugins/{SurfacePlugin → plugin-surface}/meta.ts +0 -0
@@ -1,10 +1,3 @@
1
- import {
2
- SurfaceProvider,
3
- meta_default as meta_default2,
4
- parseRootSurfacePlugin,
5
- parseSurfacePlugin,
6
- useSurfaceRoot
7
- } from "./chunk-YYV26N3W.mjs";
8
1
  import {
9
2
  IntentAction,
10
3
  IntentProvider,
@@ -14,14 +7,30 @@ import {
14
7
  useIntent,
15
8
  useIntentDispatcher,
16
9
  useIntentResolver
17
- } from "./chunk-J45KR4DI.mjs";
10
+ } from "./chunk-CDLQO5K2.mjs";
11
+ import {
12
+ ErrorBoundary,
13
+ Surface,
14
+ SurfaceProvider,
15
+ isObject,
16
+ meta_default as meta_default2,
17
+ parseRootSurfacePlugin,
18
+ parseSurfacePlugin,
19
+ useSurface,
20
+ useSurfaceRoot
21
+ } from "./chunk-EQTQGGE6.mjs";
18
22
  import {
19
23
  definePlugin,
20
24
  filterPlugins,
21
25
  findPlugin,
22
26
  getPlugin,
23
27
  resolvePlugin
24
- } from "./chunk-S5CI6EUQ.mjs";
28
+ } from "./chunk-3E7RY3CE.mjs";
29
+ import {
30
+ SettingsAction,
31
+ meta_default as meta_default3,
32
+ parseSettingsPlugin
33
+ } from "./chunk-653Y45CL.mjs";
25
34
 
26
35
  // packages/sdk/app-framework/src/plugins/common/file.ts
27
36
  var defaultFileTypes = {
@@ -101,7 +110,8 @@ var parseLayoutPlugin = (plugin) => {
101
110
  const { success } = Layout.safeParse(plugin.provides.layout);
102
111
  return success ? plugin : void 0;
103
112
  };
104
- var LAYOUT_ACTION = "dxos.org/plugin/layout";
113
+ var LAYOUT_PLUGIN = "dxos.org/plugin/layout";
114
+ var LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
105
115
  var LayoutAction;
106
116
  (function(LayoutAction2) {
107
117
  LayoutAction2[LayoutAction2["SET_LAYOUT"] = `${LAYOUT_ACTION}/set-layout`] = "SET_LAYOUT";
@@ -119,8 +129,8 @@ var parseMetadataResolverPlugin = (plugin) => {
119
129
  };
120
130
 
121
131
  // packages/sdk/app-framework/src/plugins/common/navigation.ts
132
+ import { Schema as S } from "@effect/schema";
122
133
  import { z as z2 } from "zod";
123
- import { S } from "@dxos/echo-schema";
124
134
  var SLUG_LIST_SEPARATOR = "+";
125
135
  var SLUG_ENTRY_SEPARATOR = "_";
126
136
  var SLUG_KEY_VALUE_SEPARATOR = "-";
@@ -131,7 +141,10 @@ var LayoutEntrySchema = S.mutable(S.Struct({
131
141
  path: S.optional(S.String)
132
142
  }));
133
143
  var LayoutPartSchema = S.Union(S.Literal("sidebar"), S.Literal("main"), S.Literal("solo"), S.Literal("complementary"), S.Literal("fullScreen"));
134
- var LayoutPartsSchema = S.partial(S.mutable(S.Record(LayoutPartSchema, S.mutable(S.Array(LayoutEntrySchema)))));
144
+ var LayoutPartsSchema = S.partial(S.mutable(S.Record({
145
+ key: LayoutPartSchema,
146
+ value: S.mutable(S.Array(LayoutEntrySchema))
147
+ })));
135
148
  var LayoutCoordinateSchema = S.mutable(S.Struct({
136
149
  part: LayoutPartSchema,
137
150
  entryId: S.String
@@ -145,9 +158,6 @@ var ActiveParts = z2.record(z2.string(), z2.union([
145
158
  z2.string(),
146
159
  z2.array(z2.string())
147
160
  ]));
148
- var Attention = z2.object({
149
- attended: z2.set(z2.string()).optional().describe("Ids of items which have focus.")
150
- });
151
161
  var LocationProvidesSchema = S.mutable(S.Struct({
152
162
  location: S.Struct({
153
163
  active: LayoutPartsSchema,
@@ -194,7 +204,8 @@ var partLength = (layout, part) => {
194
204
  }
195
205
  return layout[part]?.length ?? 0;
196
206
  };
197
- var NAVIGATION_ACTION = "dxos.org/plugin/navigation";
207
+ var NAVIGATION_PLUGIN = "dxos.org/plugin/navigation";
208
+ var NAVIGATION_ACTION = `${NAVIGATION_PLUGIN}/action`;
198
209
  var NavigationAction;
199
210
  (function(NavigationAction2) {
200
211
  NavigationAction2[NavigationAction2["OPEN"] = `${NAVIGATION_ACTION}/open`] = "OPEN";
@@ -205,16 +216,6 @@ var NavigationAction;
205
216
  NavigationAction2[NavigationAction2["EXPOSE"] = `${NAVIGATION_ACTION}/expose`] = "EXPOSE";
206
217
  })(NavigationAction || (NavigationAction = {}));
207
218
 
208
- // packages/sdk/app-framework/src/plugins/common/settings.ts
209
- var parseSettingsPlugin = (plugin) => {
210
- return typeof plugin.provides.settings === "object" ? plugin : void 0;
211
- };
212
- var SETTINGS_ACTION = "dxos.org/plugin/settings";
213
- var SettingsAction;
214
- (function(SettingsAction2) {
215
- SettingsAction2[SettingsAction2["OPEN"] = `${SETTINGS_ACTION}/open`] = "OPEN";
216
- })(SettingsAction || (SettingsAction = {}));
217
-
218
219
  // packages/sdk/app-framework/src/plugins/common/translations.ts
219
220
  import { z as z3 } from "zod";
220
221
  var ResourceKey = z3.union([
@@ -228,8 +229,7 @@ var parseTranslationsPlugin = (plugin) => {
228
229
  return success ? plugin : void 0;
229
230
  };
230
231
 
231
- // packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts
232
- var pluginMeta = (meta) => meta;
232
+ // packages/sdk/app-framework/src/plugins/plugin-host/plugin.ts
233
233
  var Plugin;
234
234
  (function(Plugin2) {
235
235
  Plugin2.lazy = (p, props) => {
@@ -239,245 +239,31 @@ var Plugin;
239
239
  };
240
240
  })(Plugin || (Plugin = {}));
241
241
 
242
- // packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx
243
- import { createContext, useContext, useMemo } from "react";
244
- import { nonNullable } from "@dxos/util";
245
- var PluginContext = /* @__PURE__ */ createContext({
246
- ready: false,
247
- core: [],
248
- enabled: [],
249
- plugins: [],
250
- available: [],
251
- setPlugin: () => {
252
- }
253
- });
254
- var usePlugins = () => useContext(PluginContext);
255
- var usePlugin = (id) => {
256
- const { plugins } = usePlugins();
257
- return findPlugin(plugins, id);
258
- };
259
- var useResolvePlugin = (predicate) => {
260
- const { plugins } = usePlugins();
261
- return resolvePlugin(plugins, predicate);
262
- };
263
- var useResolvePlugins = (predicate) => {
264
- const { plugins } = usePlugins();
265
- return useMemo(() => plugins.map(predicate).filter(nonNullable), [
266
- plugins,
267
- predicate
268
- ]);
269
- };
270
- var PluginProvider = PluginContext.Provider;
271
-
272
- // packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx
273
- import React3, { useEffect, useState } from "react";
242
+ // packages/sdk/app-framework/src/plugins/plugin-host/HostPlugin.tsx
243
+ import React2 from "react";
274
244
  import { LocalStorageStore } from "@dxos/local-storage";
275
- import { log } from "@dxos/log";
276
-
277
- // packages/sdk/app-framework/src/plugins/SurfacePlugin/helpers.ts
278
- var isObject = (data) => !!data && typeof data === "object";
279
245
 
280
- // packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx
281
- import React, { Component } from "react";
282
- var ErrorBoundary = class extends Component {
283
- constructor(props) {
284
- super(props);
285
- this.state = {
286
- error: void 0
287
- };
288
- }
289
- static getDerivedStateFromError(error) {
290
- return {
291
- error
292
- };
293
- }
294
- componentDidUpdate(prevProps) {
295
- if (prevProps.data !== this.props.data) {
296
- this.resetError();
297
- }
298
- }
299
- render() {
300
- if (this.state.error) {
301
- return /* @__PURE__ */ React.createElement(this.props.fallback, {
302
- data: this.props.data,
303
- error: this.state.error,
304
- reset: this.resetError
305
- });
306
- }
307
- return this.props.children;
308
- }
309
- resetError() {
310
- this.setState({
311
- error: void 0
312
- });
313
- }
314
- };
315
-
316
- // packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx
317
- import React2, { forwardRef, Fragment, isValidElement, Suspense } from "react";
318
- import { createContext as createContext2, useContext as useContext2 } from "react";
319
- import { raise } from "@dxos/debug";
320
- var Surface = /* @__PURE__ */ forwardRef(({ role, name = role, fallback, placeholder, ...rest }, forwardedRef) => {
321
- const props = {
322
- role,
323
- name,
324
- fallback,
325
- ...rest
326
- };
327
- const context = useContext2(SurfaceContext);
328
- const data = props.data ?? (name && context?.surfaces?.[name]?.data || {});
329
- const resolver = /* @__PURE__ */ React2.createElement(SurfaceResolver, {
330
- ...props,
331
- ref: forwardedRef
332
- });
333
- const suspense = placeholder ? /* @__PURE__ */ React2.createElement(Suspense, {
334
- fallback: placeholder
335
- }, resolver) : resolver;
336
- return fallback ? /* @__PURE__ */ React2.createElement(ErrorBoundary, {
337
- data,
338
- fallback
339
- }, suspense) : suspense;
340
- });
341
- var SurfaceContext = /* @__PURE__ */ createContext2(null);
342
- var useSurface = () => useContext2(SurfaceContext) ?? raise(new Error("Surface context not found"));
343
- var SurfaceResolver = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
344
- const { components } = useSurfaceRoot();
345
- const parent = useContext2(SurfaceContext);
346
- const nodes = resolveNodes(components, props, parent, forwardedRef);
347
- const currentContext = {
348
- ...props,
349
- surfaces: {
350
- ...props.name && parent?.surfaces?.[props.name]?.surfaces || {},
351
- ...props.surfaces
352
- }
353
- };
354
- return /* @__PURE__ */ React2.createElement(SurfaceContext.Provider, {
355
- value: currentContext
356
- }, nodes);
357
- });
358
- var resolveNodes = (components, props, context, forwardedRef) => {
359
- const data = {
360
- ...props.name && context?.surfaces?.[props.name]?.data || {},
361
- ...props.data
362
- };
363
- const nodes = Object.entries(components).map(([key, component]) => {
364
- const result = component({
365
- ...props,
366
- data
367
- }, forwardedRef);
368
- if (!result || typeof result !== "object") {
369
- return void 0;
370
- }
371
- return "node" in result ? [
372
- key,
373
- result
374
- ] : /* @__PURE__ */ isValidElement(result) ? [
375
- key,
376
- {
377
- node: result
378
- }
379
- ] : void 0;
380
- }).filter((result) => Boolean(result)).sort(([, a], [, b]) => {
381
- const aDisposition = a.disposition ?? "default";
382
- const bDisposition = b.disposition ?? "default";
383
- if (aDisposition === bDisposition) {
384
- return 0;
385
- } else if (aDisposition === "hoist" || bDisposition === "fallback") {
386
- return -1;
387
- } else if (bDisposition === "hoist" || aDisposition === "fallback") {
388
- return 1;
389
- }
390
- return 0;
391
- }).map(([key, result]) => /* @__PURE__ */ React2.createElement(Fragment, {
392
- key
393
- }, result.node));
394
- return props.limit ? nodes.slice(0, props.limit) : nodes;
395
- };
396
-
397
- // packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx
398
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx";
399
- var parsePluginHost = (plugin) => plugin.provides.plugins ? plugin : void 0;
400
- var PLUGIN_HOST = "dxos.org/plugin/host";
401
- var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallback = DefaultFallback, placeholder = null }) => {
402
- const state = new LocalStorageStore(PLUGIN_HOST, {
403
- ready: false,
404
- core,
405
- enabled: [
406
- ...defaults
407
- ],
408
- plugins: [],
409
- available: order.filter(({ id }) => !core.includes(id)),
410
- setPlugin: (id, enabled) => {
411
- if (enabled) {
412
- state.values.enabled.push(id);
413
- } else {
414
- const index = state.values.enabled.findIndex((enabled2) => enabled2 === id);
415
- index !== -1 && state.values.enabled.splice(index, 1);
416
- }
417
- }
418
- });
419
- state.prop({
420
- key: "enabled",
421
- type: LocalStorageStore.json()
422
- });
423
- return {
424
- meta: {
425
- id: PLUGIN_HOST,
426
- name: "Plugin host"
427
- },
428
- provides: {
429
- plugins: state.values,
430
- context: ({ children }) => /* @__PURE__ */ React3.createElement(PluginProvider, {
431
- value: state.values
432
- }, children),
433
- root: () => {
434
- return /* @__PURE__ */ React3.createElement(ErrorBoundary, {
435
- fallback
436
- }, /* @__PURE__ */ React3.createElement(Root, {
437
- order,
438
- core,
439
- definitions,
440
- state: state.values,
441
- placeholder
442
- }));
443
- }
444
- }
445
- };
446
- };
447
- var DefaultFallback = ({ error }) => {
448
- return /* @__PURE__ */ React3.createElement("div", {
449
- style: {
450
- padding: "1rem"
451
- }
452
- }, /* @__PURE__ */ React3.createElement("h1", {
453
- style: {
454
- fontSize: "1.2rem",
455
- fontWeight: 700,
456
- margin: "0.5rem 0"
457
- }
458
- }, error.message), /* @__PURE__ */ React3.createElement("pre", null, error.stack));
459
- };
460
- var Root = ({ order, core: corePluginIds, definitions, state, placeholder }) => {
246
+ // packages/sdk/app-framework/src/plugins/plugin-host/PluginContainer.tsx
247
+ import React, { useEffect, useState } from "react";
248
+ import { log } from "@dxos/log";
249
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/plugin-host/PluginContainer.tsx";
250
+ var PluginContainer = ({ plugins: definitions, core, state, placeholder }) => {
461
251
  const [error, setError] = useState();
462
252
  useEffect(() => {
463
253
  log("initializing plugins", {
464
254
  enabled: state.enabled
465
255
  }, {
466
256
  F: __dxlog_file,
467
- L: 102,
257
+ L: 26,
468
258
  S: void 0,
469
259
  C: (f, a) => f(...a)
470
260
  });
471
- const timeout = setTimeout(async () => {
261
+ const t = setTimeout(async () => {
472
262
  try {
473
263
  const enabledIds = [
474
- ...corePluginIds,
264
+ ...core,
475
265
  ...state.enabled
476
- ].sort((a, b) => {
477
- const indexA = order.findIndex(({ id }) => id === a);
478
- const indexB = order.findIndex(({ id }) => id === b);
479
- return indexA - indexB;
480
- });
266
+ ];
481
267
  const enabled = await Promise.all(enabledIds.map((id) => definitions[id]).filter((definition) => Boolean(definition)).map((definition) => definition()));
482
268
  const plugins = await Promise.all(enabled.map(async (definition) => {
483
269
  const plugin = await initializePlugin(definition).catch((err) => {
@@ -486,39 +272,47 @@ var Root = ({ order, core: corePluginIds, definitions, state, placeholder }) =>
486
272
  err
487
273
  }, {
488
274
  F: __dxlog_file,
489
- L: 122,
275
+ L: 41,
490
276
  S: void 0,
491
277
  C: (f, a) => f(...a)
492
278
  });
493
- return void 0;
279
+ });
280
+ log("initialized", {
281
+ plugin: definition.meta.id
282
+ }, {
283
+ F: __dxlog_file,
284
+ L: 44,
285
+ S: void 0,
286
+ C: (f, a) => f(...a)
494
287
  });
495
288
  return plugin;
496
- })).then((plugins2) => plugins2.filter((plugin) => Boolean(plugin)));
289
+ }));
290
+ const initialized = plugins.filter((plugin) => Boolean(plugin));
497
291
  log("plugins initialized", {
498
- plugins
292
+ plugins: initialized
499
293
  }, {
500
294
  F: __dxlog_file,
501
- L: 128,
295
+ L: 50,
502
296
  S: void 0,
503
297
  C: (f, a) => f(...a)
504
298
  });
505
- await Promise.all(enabled.map((pluginDefinition) => pluginDefinition.ready?.(plugins)));
299
+ await Promise.all(enabled.map((plugin) => plugin.ready?.(initialized)));
506
300
  log("plugins ready", {
507
- plugins
301
+ plugins: initialized
508
302
  }, {
509
303
  F: __dxlog_file,
510
- L: 131,
304
+ L: 53,
511
305
  S: void 0,
512
306
  C: (f, a) => f(...a)
513
307
  });
514
- state.plugins = plugins;
308
+ state.plugins = initialized;
515
309
  state.ready = true;
516
310
  } catch (err) {
517
311
  setError(err);
518
312
  }
519
313
  });
520
314
  return () => {
521
- clearTimeout(timeout);
315
+ clearTimeout(t);
522
316
  state.ready = false;
523
317
  };
524
318
  }, []);
@@ -526,10 +320,10 @@ var Root = ({ order, core: corePluginIds, definitions, state, placeholder }) =>
526
320
  throw error;
527
321
  }
528
322
  if (!state.ready) {
529
- return /* @__PURE__ */ React3.createElement(React3.Fragment, null, placeholder);
323
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, placeholder);
530
324
  }
531
325
  const ComposedContext = composeContext(state.plugins);
532
- return /* @__PURE__ */ React3.createElement(ComposedContext, null, rootComponents(state.plugins));
326
+ return /* @__PURE__ */ React.createElement(ComposedContext, null, rootComponents(state.plugins));
533
327
  };
534
328
  var initializePlugin = async (pluginDefinition) => {
535
329
  const provides = await pluginDefinition.initialize?.();
@@ -543,9 +337,9 @@ var initializePlugin = async (pluginDefinition) => {
543
337
  };
544
338
  var rootComponents = (plugins) => {
545
339
  return plugins.map((plugin) => {
546
- const Component2 = plugin.provides.root;
547
- if (Component2) {
548
- return /* @__PURE__ */ React3.createElement(Component2, {
340
+ const Component = plugin.provides.root;
341
+ if (Component) {
342
+ return /* @__PURE__ */ React.createElement(Component, {
549
343
  key: plugin.meta.id
550
344
  });
551
345
  } else {
@@ -559,65 +353,163 @@ var composeContext = (plugins) => {
559
353
  var compose = (contexts) => {
560
354
  return [
561
355
  ...contexts
562
- ].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ React3.createElement(Acc, null, /* @__PURE__ */ React3.createElement(Next, null, children)));
356
+ ].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ React.createElement(Acc, null, /* @__PURE__ */ React.createElement(Next, null, children)));
357
+ };
358
+
359
+ // packages/sdk/app-framework/src/plugins/plugin-host/PluginContext.tsx
360
+ import { createContext, useContext, useMemo } from "react";
361
+ import { raise } from "@dxos/debug";
362
+ import { nonNullable } from "@dxos/util";
363
+ var PluginContext = /* @__PURE__ */ createContext(void 0);
364
+ var usePlugins = () => useContext(PluginContext) ?? raise(new Error("Missing PluginContext"));
365
+ var usePlugin = (id) => {
366
+ const { plugins } = usePlugins();
367
+ return findPlugin(plugins, id);
368
+ };
369
+ var useResolvePlugin = (predicate) => {
370
+ const { plugins } = usePlugins();
371
+ return resolvePlugin(plugins, predicate);
372
+ };
373
+ var useResolvePlugins = (predicate) => {
374
+ const { plugins } = usePlugins();
375
+ return useMemo(() => plugins.map(predicate).filter(nonNullable), [
376
+ plugins,
377
+ predicate
378
+ ]);
379
+ };
380
+ var PluginProvider = PluginContext.Provider;
381
+
382
+ // packages/sdk/app-framework/src/plugins/plugin-host/HostPlugin.tsx
383
+ var parsePluginHost = (plugin) => plugin.provides.plugins ? plugin : void 0;
384
+ var HOST_PLUGIN = "dxos.org/plugin/host";
385
+ var HostPlugin = ({ plugins, meta, core, defaults = [], fallback = DefaultFallback, placeholder = null }) => {
386
+ const state = new LocalStorageStore(HOST_PLUGIN, {
387
+ ready: false,
388
+ core,
389
+ enabled: [
390
+ ...defaults
391
+ ],
392
+ plugins: [],
393
+ available: meta.filter(({ id }) => !core.includes(id)),
394
+ // TODO(burdon): Functions should not be part of the settings type.
395
+ setPlugin: (id, enabled) => {
396
+ if (enabled) {
397
+ state.values.enabled.push(id);
398
+ } else {
399
+ const index = state.values.enabled.findIndex((enabled2) => enabled2 === id);
400
+ index !== -1 && state.values.enabled.splice(index, 1);
401
+ }
402
+ }
403
+ });
404
+ state.prop({
405
+ key: "enabled",
406
+ type: LocalStorageStore.json()
407
+ });
408
+ return {
409
+ meta: {
410
+ id: HOST_PLUGIN,
411
+ name: "Plugin host"
412
+ },
413
+ provides: {
414
+ plugins: state.values,
415
+ context: ({ children }) => {
416
+ return /* @__PURE__ */ React2.createElement(PluginProvider, {
417
+ value: state.values
418
+ }, children);
419
+ },
420
+ root: () => {
421
+ return /* @__PURE__ */ React2.createElement(ErrorBoundary, {
422
+ fallback
423
+ }, /* @__PURE__ */ React2.createElement(PluginContainer, {
424
+ plugins,
425
+ core,
426
+ state: state.values,
427
+ placeholder
428
+ }));
429
+ }
430
+ }
431
+ };
432
+ };
433
+ var DefaultFallback = ({ error }) => {
434
+ return /* @__PURE__ */ React2.createElement("div", {
435
+ style: {
436
+ padding: "1rem"
437
+ }
438
+ }, /* @__PURE__ */ React2.createElement("h1", {
439
+ style: {
440
+ fontSize: "1.2rem",
441
+ fontWeight: 700,
442
+ margin: "0.5rem 0"
443
+ }
444
+ }, error.message), /* @__PURE__ */ React2.createElement("pre", null, error.stack));
563
445
  };
564
446
 
565
447
  // packages/sdk/app-framework/src/App.tsx
566
- import React4 from "react";
448
+ import React3 from "react";
567
449
  import { invariant } from "@dxos/invariant";
568
450
  var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
569
- var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }) => {
570
- const host = PluginHost({
571
- order: [
572
- meta_default2,
573
- meta_default,
574
- ...order
575
- ],
451
+ var createApp = ({ meta, plugins, core, ...params }) => {
452
+ const hostPlugin = HostPlugin({
576
453
  plugins: {
577
454
  ...plugins,
578
- [meta_default2.id]: Plugin.lazy(() => import("./plugin-K3KCPCTJ.mjs")),
579
- [meta_default.id]: Plugin.lazy(() => import("./plugin-MM66VRCO.mjs"))
455
+ [meta_default.id]: Plugin.lazy(() => import("./plugin-intent-Q5KFPKFA.mjs")),
456
+ [meta_default3.id]: Plugin.lazy(() => import("./plugin-settings-OM3G2QFY.mjs")),
457
+ [meta_default2.id]: Plugin.lazy(() => import("./plugin-surface-ZQXFAL46.mjs"))
580
458
  },
459
+ meta: [
460
+ meta_default,
461
+ meta_default3,
462
+ meta_default2,
463
+ ...meta
464
+ ],
581
465
  core: [
582
- meta_default2.id,
583
466
  meta_default.id,
467
+ meta_default3.id,
468
+ meta_default2.id,
584
469
  ...core
585
470
  ],
586
471
  ...params
587
472
  });
588
- invariant(host.provides?.context, void 0, {
473
+ invariant(hostPlugin.provides, void 0, {
474
+ F: __dxlog_file2,
475
+ L: 53,
476
+ S: void 0,
477
+ A: [
478
+ "hostPlugin.provides",
479
+ ""
480
+ ]
481
+ });
482
+ const { context: Context, root: Root } = hostPlugin.provides;
483
+ invariant(Context, void 0, {
589
484
  F: __dxlog_file2,
590
- L: 51,
485
+ L: 55,
591
486
  S: void 0,
592
487
  A: [
593
- "host.provides?.context",
488
+ "Context",
594
489
  ""
595
490
  ]
596
491
  });
597
- invariant(host.provides?.root, void 0, {
492
+ invariant(Root, void 0, {
598
493
  F: __dxlog_file2,
599
- L: 52,
494
+ L: 56,
600
495
  S: void 0,
601
496
  A: [
602
- "host.provides?.root",
497
+ "Root",
603
498
  ""
604
499
  ]
605
500
  });
606
- const Context = host.provides.context;
607
- const Root2 = host.provides.root;
608
- return () => /* @__PURE__ */ React4.createElement(Context, null, /* @__PURE__ */ React4.createElement(Root2, null));
501
+ return () => /* @__PURE__ */ React3.createElement(Context, null, /* @__PURE__ */ React3.createElement(Root, null));
609
502
  };
610
503
  export {
611
504
  ActiveParts,
612
- Attention,
613
505
  ErrorBoundary,
506
+ HostPlugin,
614
507
  IntentAction,
615
508
  IntentProvider,
616
509
  Layout,
617
510
  LayoutAction,
618
511
  NavigationAction,
619
512
  Plugin,
620
- PluginHost,
621
513
  PluginProvider,
622
514
  Resource,
623
515
  ResourceKey,
@@ -639,7 +531,6 @@ export {
639
531
  firstIdInPart,
640
532
  getPlugin,
641
533
  indexInPart,
642
- initializePlugin,
643
534
  isLayoutAdjustment,
644
535
  isLayoutMode,
645
536
  isLayoutParts,
@@ -661,7 +552,6 @@ export {
661
552
  parseSurfacePlugin,
662
553
  parseTranslationsPlugin,
663
554
  partLength,
664
- pluginMeta,
665
555
  resolvePlugin,
666
556
  useIntent,
667
557
  useIntentDispatcher,