@dxos/app-framework 0.3.8-main.8be0ad4 → 0.3.8-main.913b25a
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/node/chunk-BOQBLWMX.cjs +49 -0
- package/dist/lib/node/chunk-BOQBLWMX.cjs.map +7 -0
- package/dist/lib/node/chunk-VDKZ7AAF.cjs +43 -0
- package/dist/lib/node/chunk-VDKZ7AAF.cjs.map +7 -0
- package/dist/lib/node/chunk-YDKX45O3.cjs +48 -0
- package/dist/lib/node/chunk-YDKX45O3.cjs.map +7 -0
- package/dist/lib/node/index.cjs +62 -296
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/plugin-RCAOZKNL.cjs +61 -0
- package/dist/lib/node/plugin-RCAOZKNL.cjs.map +7 -0
- package/dist/lib/node/plugin-WDNRX2SR.cjs +84 -0
- package/dist/lib/node/plugin-WDNRX2SR.cjs.map +7 -0
- package/package.json +7 -7
- package/project.json +5 -47
package/dist/lib/node/index.cjs
CHANGED
|
@@ -5,9 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __esm = (fn, res) => function __init() {
|
|
9
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
-
};
|
|
11
8
|
var __export = (target, all) => {
|
|
12
9
|
for (var name in all)
|
|
13
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -29,207 +26,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
26
|
mod
|
|
30
27
|
));
|
|
31
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var import_debug, findPlugin, getPlugin, filterPlugins, resolvePlugin;
|
|
35
|
-
var init_helpers = __esm({
|
|
36
|
-
"packages/sdk/app-framework/src/plugins/helpers.ts"() {
|
|
37
|
-
"use strict";
|
|
38
|
-
import_debug = require("@dxos/debug");
|
|
39
|
-
findPlugin = (plugins, id) => {
|
|
40
|
-
return plugins.find((plugin) => plugin.meta.id === id || typeof plugin.meta.shortId === "string" && plugin.meta.shortId === id);
|
|
41
|
-
};
|
|
42
|
-
getPlugin = (plugins, id) => {
|
|
43
|
-
return findPlugin(plugins, id) ?? (0, import_debug.raise)(new Error(`Plugin not found: ${id}`));
|
|
44
|
-
};
|
|
45
|
-
filterPlugins = (plugins, predicate) => plugins.map((plugin) => predicate(plugin)).filter((plugin) => !!plugin);
|
|
46
|
-
resolvePlugin = (plugins, predicate) => filterPlugins(plugins, predicate)[0];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
// packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts
|
|
51
|
-
var parseIntentPlugin, parseIntentResolverPlugin;
|
|
52
|
-
var init_provides = __esm({
|
|
53
|
-
"packages/sdk/app-framework/src/plugins/IntentPlugin/provides.ts"() {
|
|
54
|
-
"use strict";
|
|
55
|
-
parseIntentPlugin = (plugin) => plugin.provides.intent?.dispatch ? plugin : void 0;
|
|
56
|
-
parseIntentResolverPlugin = (plugin) => plugin.provides.intent?.resolver ? plugin : void 0;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
// packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx
|
|
61
|
-
var import_react, IntentContext, useIntent, IntentProvider;
|
|
62
|
-
var init_IntentContext = __esm({
|
|
63
|
-
"packages/sdk/app-framework/src/plugins/IntentPlugin/IntentContext.tsx"() {
|
|
64
|
-
"use strict";
|
|
65
|
-
import_react = require("react");
|
|
66
|
-
IntentContext = /* @__PURE__ */ (0, import_react.createContext)({
|
|
67
|
-
dispatch: async () => {
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
useIntent = () => (0, import_react.useContext)(IntentContext);
|
|
71
|
-
IntentProvider = IntentContext.Provider;
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts
|
|
76
|
-
var parseRootSurfacePlugin, parseSurfacePlugin;
|
|
77
|
-
var init_provides2 = __esm({
|
|
78
|
-
"packages/sdk/app-framework/src/plugins/SurfacePlugin/provides.ts"() {
|
|
79
|
-
"use strict";
|
|
80
|
-
parseRootSurfacePlugin = (plugin) => plugin?.provides?.surface?.components ? plugin : void 0;
|
|
81
|
-
parseSurfacePlugin = (plugin) => plugin?.provides?.surface?.component ? plugin : void 0;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
// packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx
|
|
86
|
-
var import_react6, SurfaceRootContext, useSurface, SurfaceProvider;
|
|
87
|
-
var init_SurfaceRootContext = __esm({
|
|
88
|
-
"packages/sdk/app-framework/src/plugins/SurfacePlugin/SurfaceRootContext.tsx"() {
|
|
89
|
-
"use strict";
|
|
90
|
-
import_react6 = require("react");
|
|
91
|
-
SurfaceRootContext = /* @__PURE__ */ (0, import_react6.createContext)({
|
|
92
|
-
components: {}
|
|
93
|
-
});
|
|
94
|
-
useSurface = () => (0, import_react6.useContext)(SurfaceRootContext);
|
|
95
|
-
SurfaceProvider = SurfaceRootContext.Provider;
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
// packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts
|
|
100
|
-
var IntentMeta, meta_default;
|
|
101
|
-
var init_meta = __esm({
|
|
102
|
-
"packages/sdk/app-framework/src/plugins/IntentPlugin/meta.ts"() {
|
|
103
|
-
"use strict";
|
|
104
|
-
IntentMeta = {
|
|
105
|
-
id: "dxos.org/plugin/intent"
|
|
106
|
-
};
|
|
107
|
-
meta_default = IntentMeta;
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
// packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts
|
|
112
|
-
var SurfaceMeta, meta_default2;
|
|
113
|
-
var init_meta2 = __esm({
|
|
114
|
-
"packages/sdk/app-framework/src/plugins/SurfacePlugin/meta.ts"() {
|
|
115
|
-
"use strict";
|
|
116
|
-
SurfaceMeta = {
|
|
117
|
-
id: "dxos.org/plugin/surface"
|
|
118
|
-
};
|
|
119
|
-
meta_default2 = SurfaceMeta;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
// packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx
|
|
124
|
-
var plugin_exports = {};
|
|
125
|
-
__export(plugin_exports, {
|
|
126
|
-
default: () => plugin_default
|
|
127
|
-
});
|
|
128
|
-
var import_react9, import_react10, SurfacePlugin, plugin_default;
|
|
129
|
-
var init_plugin = __esm({
|
|
130
|
-
"packages/sdk/app-framework/src/plugins/SurfacePlugin/plugin.tsx"() {
|
|
131
|
-
"use strict";
|
|
132
|
-
import_react9 = require("deepsignal/react");
|
|
133
|
-
import_react10 = __toESM(require("react"));
|
|
134
|
-
init_SurfaceRootContext();
|
|
135
|
-
init_meta2();
|
|
136
|
-
init_provides2();
|
|
137
|
-
init_helpers();
|
|
138
|
-
SurfacePlugin = () => {
|
|
139
|
-
const state = (0, import_react9.deepSignal)({
|
|
140
|
-
components: {}
|
|
141
|
-
});
|
|
142
|
-
return {
|
|
143
|
-
meta: meta_default2,
|
|
144
|
-
ready: async (plugins) => {
|
|
145
|
-
state.components = (0, import_react9.shallow)(filterPlugins(plugins, parseSurfacePlugin).reduce((acc, plugin) => {
|
|
146
|
-
return {
|
|
147
|
-
...acc,
|
|
148
|
-
[plugin.meta.id]: plugin.provides.surface.component
|
|
149
|
-
};
|
|
150
|
-
}, {}));
|
|
151
|
-
},
|
|
152
|
-
provides: {
|
|
153
|
-
surface: state,
|
|
154
|
-
context: ({ children }) => /* @__PURE__ */ import_react10.default.createElement(SurfaceProvider, {
|
|
155
|
-
value: state
|
|
156
|
-
}, children)
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
plugin_default = SurfacePlugin;
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
// packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx
|
|
165
|
-
var plugin_exports2 = {};
|
|
166
|
-
__export(plugin_exports2, {
|
|
167
|
-
default: () => plugin_default2
|
|
168
|
-
});
|
|
169
|
-
var import_react11, import_react12, IntentPlugin, plugin_default2;
|
|
170
|
-
var init_plugin2 = __esm({
|
|
171
|
-
"packages/sdk/app-framework/src/plugins/IntentPlugin/plugin.tsx"() {
|
|
172
|
-
"use strict";
|
|
173
|
-
import_react11 = require("deepsignal/react");
|
|
174
|
-
import_react12 = __toESM(require("react"));
|
|
175
|
-
init_IntentContext();
|
|
176
|
-
init_meta();
|
|
177
|
-
init_provides();
|
|
178
|
-
init_helpers();
|
|
179
|
-
IntentPlugin = () => {
|
|
180
|
-
const state = (0, import_react11.deepSignal)({
|
|
181
|
-
dispatch: async () => {
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
return {
|
|
185
|
-
meta: meta_default,
|
|
186
|
-
ready: async (plugins) => {
|
|
187
|
-
const dispatch = async (intent) => {
|
|
188
|
-
if (intent.plugin) {
|
|
189
|
-
const plugin = findPlugin(plugins, intent.plugin);
|
|
190
|
-
return plugin?.provides.intent.resolver(intent, plugins);
|
|
191
|
-
}
|
|
192
|
-
for (const plugin of filterPlugins(plugins, parseIntentResolverPlugin)) {
|
|
193
|
-
const result = await plugin.provides.intent.resolver(intent, plugins);
|
|
194
|
-
if (result) {
|
|
195
|
-
return result;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
state.dispatch = async (intentOrArray) => {
|
|
200
|
-
let result = null;
|
|
201
|
-
for (const intent of Array.isArray(intentOrArray) ? intentOrArray : [
|
|
202
|
-
intentOrArray
|
|
203
|
-
]) {
|
|
204
|
-
const data = intent.data ? {
|
|
205
|
-
...result,
|
|
206
|
-
...intent.data
|
|
207
|
-
} : result;
|
|
208
|
-
result = await dispatch({
|
|
209
|
-
...intent,
|
|
210
|
-
data
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
return result;
|
|
214
|
-
};
|
|
215
|
-
},
|
|
216
|
-
provides: {
|
|
217
|
-
intent: state,
|
|
218
|
-
context: ({ children }) => /* @__PURE__ */ import_react12.default.createElement(IntentProvider, {
|
|
219
|
-
value: state
|
|
220
|
-
}, children)
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
};
|
|
224
|
-
plugin_default2 = IntentPlugin;
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
// packages/sdk/app-framework/src/index.ts
|
|
229
|
-
var src_exports = {};
|
|
230
|
-
__export(src_exports, {
|
|
29
|
+
var node_exports = {};
|
|
30
|
+
__export(node_exports, {
|
|
231
31
|
ErrorBoundary: () => ErrorBoundary,
|
|
232
|
-
IntentProvider: () => IntentProvider,
|
|
32
|
+
IntentProvider: () => import_chunk_BOQBLWMX.IntentProvider,
|
|
233
33
|
Layout: () => Layout,
|
|
234
34
|
LayoutAction: () => LayoutAction,
|
|
235
35
|
Plugin: () => Plugin,
|
|
@@ -239,39 +39,49 @@ __export(src_exports, {
|
|
|
239
39
|
ResourceKey: () => ResourceKey,
|
|
240
40
|
ResourceLanguage: () => ResourceLanguage,
|
|
241
41
|
Surface: () => Surface,
|
|
242
|
-
SurfaceProvider: () => SurfaceProvider,
|
|
42
|
+
SurfaceProvider: () => import_chunk_YDKX45O3.SurfaceProvider,
|
|
243
43
|
createApp: () => createApp,
|
|
244
|
-
filterPlugins: () => filterPlugins,
|
|
245
|
-
findPlugin: () => findPlugin,
|
|
246
|
-
getPlugin: () => getPlugin,
|
|
44
|
+
filterPlugins: () => import_chunk_VDKZ7AAF.filterPlugins,
|
|
45
|
+
findPlugin: () => import_chunk_VDKZ7AAF.findPlugin,
|
|
46
|
+
getPlugin: () => import_chunk_VDKZ7AAF.getPlugin,
|
|
247
47
|
initializePlugin: () => initializePlugin,
|
|
248
48
|
parseGraphBuilderPlugin: () => parseGraphBuilderPlugin,
|
|
249
49
|
parseGraphPlugin: () => parseGraphPlugin,
|
|
250
|
-
parseIntentPlugin: () => parseIntentPlugin,
|
|
251
|
-
parseIntentResolverPlugin: () => parseIntentResolverPlugin,
|
|
50
|
+
parseIntentPlugin: () => import_chunk_BOQBLWMX.parseIntentPlugin,
|
|
51
|
+
parseIntentResolverPlugin: () => import_chunk_BOQBLWMX.parseIntentResolverPlugin,
|
|
252
52
|
parseLayoutPlugin: () => parseLayoutPlugin,
|
|
253
53
|
parseMetadataRecordsPlugin: () => parseMetadataRecordsPlugin,
|
|
254
54
|
parseMetadataResolverPlugin: () => parseMetadataResolverPlugin,
|
|
255
55
|
parsePluginHost: () => parsePluginHost,
|
|
256
|
-
parseRootSurfacePlugin: () => parseRootSurfacePlugin,
|
|
257
|
-
parseSurfacePlugin: () => parseSurfacePlugin,
|
|
56
|
+
parseRootSurfacePlugin: () => import_chunk_YDKX45O3.parseRootSurfacePlugin,
|
|
57
|
+
parseSurfacePlugin: () => import_chunk_YDKX45O3.parseSurfacePlugin,
|
|
258
58
|
parseTranslationsPlugin: () => parseTranslationsPlugin,
|
|
259
59
|
pluginMeta: () => pluginMeta,
|
|
260
|
-
resolvePlugin: () => resolvePlugin,
|
|
261
|
-
useIntent: () => useIntent,
|
|
60
|
+
resolvePlugin: () => import_chunk_VDKZ7AAF.resolvePlugin,
|
|
61
|
+
useIntent: () => import_chunk_BOQBLWMX.useIntent,
|
|
262
62
|
usePlugin: () => usePlugin,
|
|
263
63
|
usePlugins: () => usePlugins,
|
|
264
64
|
useResolvePlugin: () => useResolvePlugin,
|
|
265
|
-
useSurface: () => useSurface
|
|
65
|
+
useSurface: () => import_chunk_YDKX45O3.useSurface
|
|
266
66
|
});
|
|
267
|
-
module.exports = __toCommonJS(
|
|
268
|
-
|
|
269
|
-
|
|
67
|
+
module.exports = __toCommonJS(node_exports);
|
|
68
|
+
var import_chunk_YDKX45O3 = require("./chunk-YDKX45O3.cjs");
|
|
69
|
+
var import_chunk_BOQBLWMX = require("./chunk-BOQBLWMX.cjs");
|
|
70
|
+
var import_chunk_VDKZ7AAF = require("./chunk-VDKZ7AAF.cjs");
|
|
71
|
+
var import_zod = require("zod");
|
|
72
|
+
var import_zod2 = require("zod");
|
|
73
|
+
var import_react = require("react");
|
|
74
|
+
var import_react2 = require("deepsignal/react");
|
|
75
|
+
var import_react3 = __toESM(require("react"));
|
|
76
|
+
var import_local_storage = require("@dxos/local-storage");
|
|
77
|
+
var import_log = require("@dxos/log");
|
|
78
|
+
var import_react4 = __toESM(require("react"));
|
|
79
|
+
var import_react5 = __toESM(require("react"));
|
|
80
|
+
var import_react6 = require("react");
|
|
81
|
+
var import_react7 = __toESM(require("react"));
|
|
82
|
+
var import_invariant = require("@dxos/invariant");
|
|
270
83
|
var parseGraphPlugin = (plugin) => plugin.provides.graph?.root ? plugin : void 0;
|
|
271
84
|
var parseGraphBuilderPlugin = (plugin) => plugin.provides.graph?.builder ? plugin : void 0;
|
|
272
|
-
|
|
273
|
-
// packages/sdk/app-framework/src/plugins/common/layout.ts
|
|
274
|
-
var import_zod = require("zod");
|
|
275
85
|
var Layout = import_zod.z.object({
|
|
276
86
|
fullscreen: import_zod.z.boolean(),
|
|
277
87
|
sidebarOpen: import_zod.z.boolean(),
|
|
@@ -302,17 +112,12 @@ var LayoutAction;
|
|
|
302
112
|
LayoutAction2[LayoutAction2["CLOSE_POPOVER"] = `${LAYOUT_ACTION}/close-popover`] = "CLOSE_POPOVER";
|
|
303
113
|
LayoutAction2[LayoutAction2["ACTIVATE"] = `${LAYOUT_ACTION}/activate`] = "ACTIVATE";
|
|
304
114
|
})(LayoutAction || (LayoutAction = {}));
|
|
305
|
-
|
|
306
|
-
// packages/sdk/app-framework/src/plugins/common/metadata.ts
|
|
307
115
|
var parseMetadataRecordsPlugin = (plugin) => {
|
|
308
116
|
return plugin.provides.metadata?.records ? plugin : void 0;
|
|
309
117
|
};
|
|
310
118
|
var parseMetadataResolverPlugin = (plugin) => {
|
|
311
119
|
return plugin.provides.metadata?.resolver ? plugin : void 0;
|
|
312
120
|
};
|
|
313
|
-
|
|
314
|
-
// packages/sdk/app-framework/src/plugins/common/translations.ts
|
|
315
|
-
var import_zod2 = require("zod");
|
|
316
121
|
var ResourceKey = import_zod2.z.union([
|
|
317
122
|
import_zod2.z.string(),
|
|
318
123
|
import_zod2.z.record(import_zod2.z.any())
|
|
@@ -323,15 +128,6 @@ var parseTranslationsPlugin = (plugin) => {
|
|
|
323
128
|
const { success } = import_zod2.z.array(Resource).safeParse(plugin.provides.translations);
|
|
324
129
|
return success ? plugin : void 0;
|
|
325
130
|
};
|
|
326
|
-
|
|
327
|
-
// packages/sdk/app-framework/src/plugins/index.ts
|
|
328
|
-
init_helpers();
|
|
329
|
-
|
|
330
|
-
// packages/sdk/app-framework/src/plugins/IntentPlugin/index.ts
|
|
331
|
-
init_provides();
|
|
332
|
-
init_IntentContext();
|
|
333
|
-
|
|
334
|
-
// packages/sdk/app-framework/src/plugins/PluginHost/plugin.ts
|
|
335
131
|
var pluginMeta = (meta) => meta;
|
|
336
132
|
var Plugin;
|
|
337
133
|
(function(Plugin2) {
|
|
@@ -341,11 +137,7 @@ var Plugin;
|
|
|
341
137
|
});
|
|
342
138
|
};
|
|
343
139
|
})(Plugin || (Plugin = {}));
|
|
344
|
-
|
|
345
|
-
// packages/sdk/app-framework/src/plugins/PluginHost/PluginContext.tsx
|
|
346
|
-
var import_react2 = require("react");
|
|
347
|
-
init_helpers();
|
|
348
|
-
var PluginContext = /* @__PURE__ */ (0, import_react2.createContext)({
|
|
140
|
+
var PluginContext = /* @__PURE__ */ (0, import_react.createContext)({
|
|
349
141
|
ready: false,
|
|
350
142
|
enabled: [],
|
|
351
143
|
plugins: [],
|
|
@@ -355,22 +147,16 @@ var PluginContext = /* @__PURE__ */ (0, import_react2.createContext)({
|
|
|
355
147
|
disablePlugin: () => {
|
|
356
148
|
}
|
|
357
149
|
});
|
|
358
|
-
var usePlugins = () => (0,
|
|
150
|
+
var usePlugins = () => (0, import_react.useContext)(PluginContext);
|
|
359
151
|
var usePlugin = (id) => {
|
|
360
152
|
const { plugins } = usePlugins();
|
|
361
|
-
return findPlugin(plugins, id);
|
|
153
|
+
return (0, import_chunk_VDKZ7AAF.findPlugin)(plugins, id);
|
|
362
154
|
};
|
|
363
155
|
var useResolvePlugin = (predicate) => {
|
|
364
156
|
const { plugins } = usePlugins();
|
|
365
|
-
return resolvePlugin(plugins, predicate);
|
|
157
|
+
return (0, import_chunk_VDKZ7AAF.resolvePlugin)(plugins, predicate);
|
|
366
158
|
};
|
|
367
159
|
var PluginProvider = PluginContext.Provider;
|
|
368
|
-
|
|
369
|
-
// packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx
|
|
370
|
-
var import_react3 = require("deepsignal/react");
|
|
371
|
-
var import_react4 = __toESM(require("react"));
|
|
372
|
-
var import_local_storage = require("@dxos/local-storage");
|
|
373
|
-
var import_log = require("@dxos/log");
|
|
374
160
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugins/PluginHost/PluginHost.tsx";
|
|
375
161
|
var parsePluginHost = (plugin) => plugin.provides.plugins ? plugin : void 0;
|
|
376
162
|
var PLUGIN_HOST = "dxos.org/plugin/host";
|
|
@@ -400,11 +186,11 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
400
186
|
},
|
|
401
187
|
provides: {
|
|
402
188
|
plugins: state.values,
|
|
403
|
-
context: ({ children }) => /* @__PURE__ */
|
|
189
|
+
context: ({ children }) => /* @__PURE__ */ import_react3.default.createElement(PluginProvider, {
|
|
404
190
|
value: state.values
|
|
405
191
|
}, children),
|
|
406
192
|
root: () => {
|
|
407
|
-
(0,
|
|
193
|
+
(0, import_react3.useEffect)(() => {
|
|
408
194
|
(0, import_log.log)("initializing plugins", {
|
|
409
195
|
enabled: state.values.enabled
|
|
410
196
|
}, {
|
|
@@ -449,7 +235,7 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
449
235
|
S: void 0,
|
|
450
236
|
C: (f, a) => f(...a)
|
|
451
237
|
});
|
|
452
|
-
state.values.plugins = (0,
|
|
238
|
+
state.values.plugins = (0, import_react2.shallow)(plugins);
|
|
453
239
|
state.values.ready = true;
|
|
454
240
|
});
|
|
455
241
|
return () => {
|
|
@@ -458,10 +244,10 @@ var PluginHost = ({ order, plugins: definitions, core = [], defaults = [], fallb
|
|
|
458
244
|
};
|
|
459
245
|
}, []);
|
|
460
246
|
if (!state.values.ready) {
|
|
461
|
-
return /* @__PURE__ */
|
|
247
|
+
return /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, fallback);
|
|
462
248
|
}
|
|
463
249
|
const ComposedContext = composeContext(state.values.plugins);
|
|
464
|
-
return /* @__PURE__ */
|
|
250
|
+
return /* @__PURE__ */ import_react3.default.createElement(ComposedContext, null, rootComponents(state.values.plugins));
|
|
465
251
|
}
|
|
466
252
|
}
|
|
467
253
|
};
|
|
@@ -480,7 +266,7 @@ var rootComponents = (plugins) => {
|
|
|
480
266
|
return plugins.map((plugin) => {
|
|
481
267
|
const Component2 = plugin.provides.root;
|
|
482
268
|
if (Component2) {
|
|
483
|
-
return /* @__PURE__ */
|
|
269
|
+
return /* @__PURE__ */ import_react3.default.createElement(Component2, {
|
|
484
270
|
key: plugin.meta.id
|
|
485
271
|
});
|
|
486
272
|
} else {
|
|
@@ -494,15 +280,9 @@ var composeContext = (plugins) => {
|
|
|
494
280
|
var compose = (contexts) => {
|
|
495
281
|
return [
|
|
496
282
|
...contexts
|
|
497
|
-
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */
|
|
283
|
+
].reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ import_react3.default.createElement(Acc, null, /* @__PURE__ */ import_react3.default.createElement(Next, null, children)));
|
|
498
284
|
};
|
|
499
|
-
|
|
500
|
-
// packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts
|
|
501
|
-
init_provides2();
|
|
502
|
-
|
|
503
|
-
// packages/sdk/app-framework/src/plugins/SurfacePlugin/ErrorBoundary.tsx
|
|
504
|
-
var import_react5 = __toESM(require("react"));
|
|
505
|
-
var ErrorBoundary = class extends import_react5.Component {
|
|
285
|
+
var ErrorBoundary = class extends import_react4.Component {
|
|
506
286
|
constructor(props) {
|
|
507
287
|
super(props);
|
|
508
288
|
this.state = {
|
|
@@ -521,7 +301,7 @@ var ErrorBoundary = class extends import_react5.Component {
|
|
|
521
301
|
}
|
|
522
302
|
render() {
|
|
523
303
|
if (this.state.error) {
|
|
524
|
-
return /* @__PURE__ */
|
|
304
|
+
return /* @__PURE__ */ import_react4.default.createElement(this.props.fallback, {
|
|
525
305
|
error: this.state.error,
|
|
526
306
|
reset: this.resetError
|
|
527
307
|
});
|
|
@@ -534,35 +314,30 @@ var ErrorBoundary = class extends import_react5.Component {
|
|
|
534
314
|
});
|
|
535
315
|
}
|
|
536
316
|
};
|
|
537
|
-
|
|
538
|
-
// packages/sdk/app-framework/src/plugins/SurfacePlugin/Surface.tsx
|
|
539
|
-
var import_react7 = __toESM(require("react"));
|
|
540
|
-
var import_react8 = require("react");
|
|
541
|
-
init_SurfaceRootContext();
|
|
542
|
-
var Surface = /* @__PURE__ */ (0, import_react7.forwardRef)(({ role, name = role, fallback, ...rest }, forwardedRef) => {
|
|
317
|
+
var Surface = /* @__PURE__ */ (0, import_react5.forwardRef)(({ role, name = role, fallback, ...rest }, forwardedRef) => {
|
|
543
318
|
const props = {
|
|
544
319
|
role,
|
|
545
320
|
name,
|
|
546
321
|
fallback,
|
|
547
322
|
...rest
|
|
548
323
|
};
|
|
549
|
-
const context = (0,
|
|
324
|
+
const context = (0, import_react6.useContext)(SurfaceContext);
|
|
550
325
|
const data = props.data ?? (name && context?.surfaces?.[name]?.data || {});
|
|
551
|
-
return /* @__PURE__ */
|
|
326
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, fallback ? /* @__PURE__ */ import_react5.default.createElement(ErrorBoundary, {
|
|
552
327
|
data,
|
|
553
328
|
fallback
|
|
554
|
-
}, /* @__PURE__ */
|
|
329
|
+
}, /* @__PURE__ */ import_react5.default.createElement(SurfaceResolver, {
|
|
555
330
|
...props,
|
|
556
331
|
ref: forwardedRef
|
|
557
|
-
})) : /* @__PURE__ */
|
|
332
|
+
})) : /* @__PURE__ */ import_react5.default.createElement(SurfaceResolver, {
|
|
558
333
|
...props,
|
|
559
334
|
ref: forwardedRef
|
|
560
335
|
}));
|
|
561
336
|
});
|
|
562
|
-
var SurfaceContext = /* @__PURE__ */ (0,
|
|
563
|
-
var SurfaceResolver = /* @__PURE__ */ (0,
|
|
564
|
-
const { components } = useSurface();
|
|
565
|
-
const parent = (0,
|
|
337
|
+
var SurfaceContext = /* @__PURE__ */ (0, import_react6.createContext)(null);
|
|
338
|
+
var SurfaceResolver = /* @__PURE__ */ (0, import_react5.forwardRef)((props, forwardedRef) => {
|
|
339
|
+
const { components } = (0, import_chunk_YDKX45O3.useSurface)();
|
|
340
|
+
const parent = (0, import_react6.useContext)(SurfaceContext);
|
|
566
341
|
const nodes = resolveNodes(components, props, parent, forwardedRef);
|
|
567
342
|
const currentContext = {
|
|
568
343
|
...props,
|
|
@@ -571,9 +346,9 @@ var SurfaceResolver = /* @__PURE__ */ (0, import_react7.forwardRef)((props, forw
|
|
|
571
346
|
...props.surfaces
|
|
572
347
|
}
|
|
573
348
|
};
|
|
574
|
-
return /* @__PURE__ */
|
|
349
|
+
return /* @__PURE__ */ import_react5.default.createElement(SurfaceContext.Provider, {
|
|
575
350
|
value: currentContext
|
|
576
|
-
}, nodes.length > 0 ? nodes : props.contentFallback ? /* @__PURE__ */
|
|
351
|
+
}, nodes.length > 0 ? nodes : props.contentFallback ? /* @__PURE__ */ import_react5.default.createElement(props.contentFallback, null) : null);
|
|
577
352
|
});
|
|
578
353
|
var resolveNodes = (components, props, context, forwardedRef) => {
|
|
579
354
|
const data = {
|
|
@@ -585,37 +360,28 @@ var resolveNodes = (components, props, context, forwardedRef) => {
|
|
|
585
360
|
...props,
|
|
586
361
|
data
|
|
587
362
|
}, forwardedRef);
|
|
588
|
-
return result ? /* @__PURE__ */
|
|
363
|
+
return result ? /* @__PURE__ */ import_react5.default.createElement(import_react5.Fragment, {
|
|
589
364
|
key
|
|
590
365
|
}, result) : void 0;
|
|
591
366
|
}).filter((Component2) => Boolean(Component2));
|
|
592
367
|
return props.limit ? nodes.slice(0, props.limit) : nodes;
|
|
593
368
|
};
|
|
594
|
-
|
|
595
|
-
// packages/sdk/app-framework/src/plugins/SurfacePlugin/index.ts
|
|
596
|
-
init_SurfaceRootContext();
|
|
597
|
-
|
|
598
|
-
// packages/sdk/app-framework/src/App.tsx
|
|
599
|
-
var import_react13 = __toESM(require("react"));
|
|
600
|
-
var import_invariant = require("@dxos/invariant");
|
|
601
|
-
init_meta();
|
|
602
|
-
init_meta2();
|
|
603
369
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
|
|
604
370
|
var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }) => {
|
|
605
371
|
const host = PluginHost({
|
|
606
372
|
order: [
|
|
607
|
-
|
|
608
|
-
meta_default,
|
|
373
|
+
import_chunk_YDKX45O3.meta_default,
|
|
374
|
+
import_chunk_BOQBLWMX.meta_default,
|
|
609
375
|
...order
|
|
610
376
|
],
|
|
611
377
|
plugins: {
|
|
612
378
|
...plugins,
|
|
613
|
-
[
|
|
614
|
-
[meta_default.id]: Plugin.lazy(() =>
|
|
379
|
+
[import_chunk_YDKX45O3.meta_default.id]: Plugin.lazy(() => import("./plugin-RCAOZKNL.cjs")),
|
|
380
|
+
[import_chunk_BOQBLWMX.meta_default.id]: Plugin.lazy(() => import("./plugin-WDNRX2SR.cjs"))
|
|
615
381
|
},
|
|
616
382
|
core: [
|
|
617
|
-
|
|
618
|
-
meta_default.id,
|
|
383
|
+
import_chunk_YDKX45O3.meta_default.id,
|
|
384
|
+
import_chunk_BOQBLWMX.meta_default.id,
|
|
619
385
|
...core
|
|
620
386
|
],
|
|
621
387
|
...params
|
|
@@ -640,7 +406,7 @@ var createApp = ({ order, plugins, core = order.map(({ id }) => id), ...params }
|
|
|
640
406
|
});
|
|
641
407
|
const Context = host.provides.context;
|
|
642
408
|
const Root = host.provides.root;
|
|
643
|
-
return () => /* @__PURE__ */
|
|
409
|
+
return () => /* @__PURE__ */ import_react7.default.createElement(Context, null, /* @__PURE__ */ import_react7.default.createElement(Root, null));
|
|
644
410
|
};
|
|
645
411
|
// Annotate the CommonJS export names for ESM import in node:
|
|
646
412
|
0 && (module.exports = {
|