@dxos/app-framework 0.7.4 → 0.7.5-main.937ce75
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/browser/chunk-QG25ZU2N.mjs +320 -0
- package/dist/lib/browser/chunk-QG25ZU2N.mjs.map +7 -0
- package/dist/lib/browser/chunk-SPDTXTOV.mjs +163 -0
- package/dist/lib/browser/chunk-SPDTXTOV.mjs.map +7 -0
- package/dist/lib/browser/{chunk-653Y45CL.mjs → chunk-WBOXEHBE.mjs} +12 -2
- package/dist/lib/browser/chunk-WBOXEHBE.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +224 -109
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{plugin-intent-LU4KL2RO.mjs → plugin-intent-T7Y3MJ5C.mjs} +14 -4
- package/dist/lib/browser/{plugin-settings-OM3G2QFY.mjs → plugin-settings-5U2L2NRU.mjs} +6 -2
- package/dist/lib/browser/{plugin-surface-LECZMKSQ.mjs → plugin-surface-OKPF3EQI.mjs} +4 -4
- package/dist/lib/node/{chunk-SOVLKUWI.cjs → chunk-BW3RNEVI.cjs} +51 -102
- package/dist/lib/node/chunk-BW3RNEVI.cjs.map +7 -0
- package/dist/lib/node/{chunk-JZ2JVKRY.cjs → chunk-FCMHRU3M.cjs} +17 -5
- package/dist/lib/node/chunk-FCMHRU3M.cjs.map +7 -0
- package/dist/lib/node/chunk-VWHAALIN.cjs +344 -0
- package/dist/lib/node/chunk-VWHAALIN.cjs.map +7 -0
- package/dist/lib/node/index.cjs +232 -114
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/plugin-intent-F3TQZIUR.cjs +53 -0
- package/dist/lib/node/plugin-intent-F3TQZIUR.cjs.map +7 -0
- package/dist/lib/node/{plugin-settings-OZ6IKAE5.cjs → plugin-settings-W6UHMH5M.cjs} +12 -8
- package/dist/lib/node/plugin-settings-W6UHMH5M.cjs.map +7 -0
- package/dist/lib/node/{plugin-surface-YWDRXQTD.cjs → plugin-surface-CCSIONYW.cjs} +15 -15
- package/dist/lib/node/plugin-surface-CCSIONYW.cjs.map +7 -0
- package/dist/lib/node-esm/{chunk-YNU7FTGJ.mjs → chunk-3T5UIJY3.mjs} +12 -2
- package/dist/lib/node-esm/chunk-3T5UIJY3.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-4GX7V5ZE.mjs +164 -0
- package/dist/lib/node-esm/chunk-4GX7V5ZE.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CFOUYXQ6.mjs +321 -0
- package/dist/lib/node-esm/chunk-CFOUYXQ6.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +224 -109
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{plugin-intent-V7ER24Y6.mjs → plugin-intent-W2HQC6LC.mjs} +14 -4
- package/dist/lib/node-esm/{plugin-settings-37UVWF2V.mjs → plugin-settings-H5RHNFVC.mjs} +6 -2
- package/dist/lib/node-esm/{plugin-surface-TEU42XQN.mjs → plugin-surface-V3YET3UL.mjs} +4 -4
- package/dist/types/src/plugins/common/layout.d.ts +145 -171
- package/dist/types/src/plugins/common/layout.d.ts.map +1 -1
- package/dist/types/src/plugins/common/navigation.d.ts +77 -30
- package/dist/types/src/plugins/common/navigation.d.ts.map +1 -1
- package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts +2 -7
- package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts.map +1 -1
- package/dist/types/src/plugins/plugin-host/index.d.ts +2 -0
- package/dist/types/src/plugins/plugin-host/index.d.ts.map +1 -1
- package/dist/types/src/plugins/plugin-host/plugin.d.ts +7 -1
- package/dist/types/src/plugins/plugin-host/plugin.d.ts.map +1 -1
- package/dist/types/src/plugins/plugin-intent/IntentContext.d.ts +7 -20
- package/dist/types/src/plugins/plugin-intent/IntentContext.d.ts.map +1 -1
- package/dist/types/src/plugins/plugin-intent/IntentPlugin.d.ts.map +1 -1
- package/dist/types/src/plugins/plugin-intent/index.d.ts +1 -0
- package/dist/types/src/plugins/plugin-intent/index.d.ts.map +1 -1
- package/dist/types/src/plugins/plugin-intent/intent-dispatcher.d.ts +107 -0
- package/dist/types/src/plugins/plugin-intent/intent-dispatcher.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-intent/intent-dispatcher.test.d.ts +2 -0
- package/dist/types/src/plugins/plugin-intent/intent-dispatcher.test.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-intent/intent.d.ts +65 -58
- package/dist/types/src/plugins/plugin-intent/intent.d.ts.map +1 -1
- package/dist/types/src/plugins/plugin-intent/meta.d.ts +1 -0
- package/dist/types/src/plugins/plugin-intent/meta.d.ts.map +1 -1
- package/dist/types/src/plugins/plugin-intent/provides.d.ts +6 -10
- package/dist/types/src/plugins/plugin-intent/provides.d.ts.map +1 -1
- package/dist/types/src/plugins/plugin-settings/provides.d.ts +15 -2
- package/dist/types/src/plugins/plugin-settings/provides.d.ts.map +1 -1
- package/dist/types/src/plugins/plugin-surface/Surface.d.ts +2 -57
- package/dist/types/src/plugins/plugin-surface/Surface.d.ts.map +1 -1
- package/dist/types/src/plugins/plugin-surface/SurfaceContext.d.ts +85 -0
- package/dist/types/src/plugins/plugin-surface/SurfaceContext.d.ts.map +1 -0
- package/dist/types/src/plugins/plugin-surface/SurfacePlugin.d.ts.map +1 -1
- package/dist/types/src/plugins/plugin-surface/index.d.ts +1 -1
- package/dist/types/src/plugins/plugin-surface/index.d.ts.map +1 -1
- package/dist/types/src/plugins/plugin-surface/provides.d.ts +5 -4
- package/dist/types/src/plugins/plugin-surface/provides.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +14 -12
- package/src/plugins/common/layout.ts +125 -107
- package/src/plugins/common/navigation.ts +59 -30
- package/src/plugins/plugin-host/HostPlugin.tsx +2 -10
- package/src/plugins/plugin-host/PluginContainer.tsx +1 -1
- package/src/plugins/plugin-host/index.ts +4 -0
- package/src/plugins/plugin-host/plugin.ts +8 -1
- package/src/plugins/plugin-intent/IntentContext.tsx +13 -36
- package/src/plugins/plugin-intent/IntentPlugin.tsx +44 -120
- package/src/plugins/plugin-intent/index.ts +1 -0
- package/src/plugins/plugin-intent/intent-dispatcher.test.ts +279 -0
- package/src/plugins/plugin-intent/intent-dispatcher.ts +285 -0
- package/src/plugins/plugin-intent/intent.ts +126 -65
- package/src/plugins/plugin-intent/meta.ts +3 -1
- package/src/plugins/plugin-intent/provides.ts +8 -20
- package/src/plugins/plugin-settings/provides.ts +10 -5
- package/src/plugins/plugin-surface/Surface.tsx +25 -158
- package/src/plugins/plugin-surface/SurfaceContext.ts +112 -0
- package/src/plugins/plugin-surface/SurfacePlugin.tsx +19 -7
- package/src/plugins/plugin-surface/index.ts +1 -1
- package/src/plugins/plugin-surface/provides.ts +8 -7
- package/tsconfig.json +38 -1
- package/dist/lib/browser/chunk-653Y45CL.mjs.map +0 -7
- package/dist/lib/browser/chunk-FRXJ25VI.mjs +0 -214
- package/dist/lib/browser/chunk-FRXJ25VI.mjs.map +0 -7
- package/dist/lib/browser/chunk-YXM35XRE.mjs +0 -213
- package/dist/lib/browser/chunk-YXM35XRE.mjs.map +0 -7
- package/dist/lib/node/chunk-JZ2JVKRY.cjs.map +0 -7
- package/dist/lib/node/chunk-QSVP5HOW.cjs +0 -238
- package/dist/lib/node/chunk-QSVP5HOW.cjs.map +0 -7
- package/dist/lib/node/chunk-SOVLKUWI.cjs.map +0 -7
- package/dist/lib/node/plugin-intent-FVFR2LKB.cjs +0 -43
- package/dist/lib/node/plugin-intent-FVFR2LKB.cjs.map +0 -7
- package/dist/lib/node/plugin-settings-OZ6IKAE5.cjs.map +0 -7
- package/dist/lib/node/plugin-surface-YWDRXQTD.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-2R4GVK7O.mjs +0 -215
- package/dist/lib/node-esm/chunk-2R4GVK7O.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YFMFQBB4.mjs +0 -214
- package/dist/lib/node-esm/chunk-YFMFQBB4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YNU7FTGJ.mjs.map +0 -7
- package/dist/types/src/plugins/plugin-intent/helpers.d.ts +0 -6
- package/dist/types/src/plugins/plugin-intent/helpers.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/SurfaceRootContext.d.ts +0 -39
- package/dist/types/src/plugins/plugin-surface/SurfaceRootContext.d.ts.map +0 -1
- package/src/plugins/plugin-intent/helpers.ts +0 -11
- package/src/plugins/plugin-surface/SurfaceRootContext.tsx +0 -60
- /package/dist/lib/browser/{plugin-intent-LU4KL2RO.mjs.map → plugin-intent-T7Y3MJ5C.mjs.map} +0 -0
- /package/dist/lib/browser/{plugin-settings-OM3G2QFY.mjs.map → plugin-settings-5U2L2NRU.mjs.map} +0 -0
- /package/dist/lib/browser/{plugin-surface-LECZMKSQ.mjs.map → plugin-surface-OKPF3EQI.mjs.map} +0 -0
- /package/dist/lib/node-esm/{plugin-intent-V7ER24Y6.mjs.map → plugin-intent-W2HQC6LC.mjs.map} +0 -0
- /package/dist/lib/node-esm/{plugin-settings-37UVWF2V.mjs.map → plugin-settings-H5RHNFVC.mjs.map} +0 -0
- /package/dist/lib/node-esm/{plugin-surface-TEU42XQN.mjs.map → plugin-surface-V3YET3UL.mjs.map} +0 -0
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
|
+
INTENT_ACTION,
|
|
2
3
|
IntentAction,
|
|
3
4
|
IntentProvider,
|
|
5
|
+
Label,
|
|
6
|
+
chain,
|
|
7
|
+
createDispatcher,
|
|
8
|
+
createIntent,
|
|
9
|
+
createResolver,
|
|
4
10
|
meta_default,
|
|
5
11
|
parseIntentPlugin,
|
|
6
12
|
parseIntentResolverPlugin,
|
|
7
|
-
useIntent,
|
|
8
13
|
useIntentDispatcher,
|
|
9
14
|
useIntentResolver
|
|
10
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QG25ZU2N.mjs";
|
|
11
16
|
import {
|
|
12
17
|
ErrorBoundary,
|
|
13
18
|
Surface,
|
|
14
19
|
SurfaceProvider,
|
|
20
|
+
createSurface,
|
|
15
21
|
isObject,
|
|
16
22
|
meta_default as meta_default2,
|
|
17
23
|
parseRootSurfacePlugin,
|
|
18
24
|
parseSurfacePlugin,
|
|
19
|
-
useSurface,
|
|
20
25
|
useSurfaceRoot
|
|
21
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-SPDTXTOV.mjs";
|
|
22
27
|
import {
|
|
23
28
|
definePlugin,
|
|
24
29
|
filterPlugins,
|
|
@@ -27,10 +32,12 @@ import {
|
|
|
27
32
|
resolvePlugin
|
|
28
33
|
} from "./chunk-3E7RY3CE.mjs";
|
|
29
34
|
import {
|
|
35
|
+
SETTINGS_ACTION,
|
|
36
|
+
SETTINGS_PLUGIN,
|
|
30
37
|
SettingsAction,
|
|
31
38
|
meta_default as meta_default3,
|
|
32
39
|
parseSettingsPlugin
|
|
33
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-WBOXEHBE.mjs";
|
|
34
41
|
|
|
35
42
|
// packages/sdk/app-framework/src/plugins/common/file.ts
|
|
36
43
|
var defaultFileTypes = {
|
|
@@ -62,66 +69,117 @@ var parseGraphBuilderPlugin = (plugin) => plugin.provides.graph?.builder ? plugi
|
|
|
62
69
|
var parseGraphSerializerPlugin = (plugin) => plugin.provides.graph?.serializer ? plugin : void 0;
|
|
63
70
|
|
|
64
71
|
// packages/sdk/app-framework/src/plugins/common/layout.ts
|
|
65
|
-
import {
|
|
66
|
-
var Toast =
|
|
67
|
-
id:
|
|
68
|
-
title:
|
|
69
|
-
description:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
onAction:
|
|
72
|
+
import { S } from "@dxos/echo-schema";
|
|
73
|
+
var Toast = S.Struct({
|
|
74
|
+
id: S.String,
|
|
75
|
+
title: S.optional(Label),
|
|
76
|
+
description: S.optional(Label),
|
|
77
|
+
icon: S.optional(S.String),
|
|
78
|
+
duration: S.optional(S.Number),
|
|
79
|
+
closeLabel: S.optional(Label),
|
|
80
|
+
actionLabel: S.optional(Label),
|
|
81
|
+
actionAlt: S.optional(Label),
|
|
82
|
+
// TODO(wittjosiah): Make class with customizable method?
|
|
83
|
+
onAction: S.optional(S.Any)
|
|
77
84
|
});
|
|
78
|
-
var LayoutMode =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
var Layout = z.object({
|
|
85
|
-
layoutMode: z.union([
|
|
86
|
-
z.literal("deck"),
|
|
87
|
-
z.literal("solo"),
|
|
88
|
-
z.literal("fullscreen")
|
|
89
|
-
]),
|
|
90
|
-
sidebarOpen: z.boolean(),
|
|
91
|
-
complementarySidebarOpen: z.boolean(),
|
|
85
|
+
var LayoutMode = S.Union(S.Literal("deck"), S.Literal("solo"), S.Literal("fullscreen"));
|
|
86
|
+
var isLayoutMode = (value) => S.is(LayoutMode)(value);
|
|
87
|
+
var Layout = S.mutable(S.Struct({
|
|
88
|
+
layoutMode: LayoutMode,
|
|
89
|
+
sidebarOpen: S.Boolean,
|
|
90
|
+
complementarySidebarOpen: S.Boolean,
|
|
92
91
|
/**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
complementarySidebarContent:
|
|
96
|
-
dialogOpen:
|
|
97
|
-
|
|
92
|
+
* @deprecated Data to be passed to the complementary sidebar Surface.
|
|
93
|
+
*/
|
|
94
|
+
complementarySidebarContent: S.optional(S.Any),
|
|
95
|
+
dialogOpen: S.Boolean,
|
|
96
|
+
/**
|
|
97
|
+
* Data to be passed to the dialog Surface.
|
|
98
|
+
*/
|
|
99
|
+
dialogContent: S.optional(S.Any),
|
|
98
100
|
// TODO(wittjosiah): Custom properties?
|
|
99
|
-
dialogBlockAlign:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
scrollIntoView:
|
|
112
|
-
});
|
|
101
|
+
dialogBlockAlign: S.optional(S.Literal("start", "center")),
|
|
102
|
+
dialogType: S.optional(S.Literal("default", "alert")),
|
|
103
|
+
popoverOpen: S.Boolean,
|
|
104
|
+
/**
|
|
105
|
+
* Data to be passed to the popover Surface.
|
|
106
|
+
*/
|
|
107
|
+
popoverContent: S.optional(S.Any),
|
|
108
|
+
popoverAnchorId: S.optional(S.String),
|
|
109
|
+
toasts: S.mutable(S.Array(Toast)),
|
|
110
|
+
/**
|
|
111
|
+
* The identifier of a component to scroll into view when it is mounted.
|
|
112
|
+
*/
|
|
113
|
+
scrollIntoView: S.optional(S.String)
|
|
114
|
+
}));
|
|
113
115
|
var parseLayoutPlugin = (plugin) => {
|
|
114
|
-
const
|
|
116
|
+
const success = S.is(Layout)(plugin.provides.layout);
|
|
115
117
|
return success ? plugin : void 0;
|
|
116
118
|
};
|
|
117
119
|
var LAYOUT_PLUGIN = "dxos.org/plugin/layout";
|
|
118
120
|
var LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
|
|
119
121
|
var LayoutAction;
|
|
120
122
|
(function(LayoutAction2) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
class SetLayout extends S.TaggedClass()(`${LAYOUT_ACTION}/set-layout`, {
|
|
124
|
+
input: S.Struct({
|
|
125
|
+
/**
|
|
126
|
+
* Element to set the state of.
|
|
127
|
+
*/
|
|
128
|
+
element: S.Literal("fullscreen", "sidebar", "complementary", "dialog", "popover", "toast"),
|
|
129
|
+
/**
|
|
130
|
+
* Whether the element is on or off.
|
|
131
|
+
*
|
|
132
|
+
* If omitted, the element's state will be toggled or set based on other provided data.
|
|
133
|
+
* For example, if `component` is provided, the state will be set to `true`.
|
|
134
|
+
*/
|
|
135
|
+
state: S.optional(S.Boolean),
|
|
136
|
+
/**
|
|
137
|
+
* Component to render in the dialog or popover.
|
|
138
|
+
*/
|
|
139
|
+
component: S.optional(S.String),
|
|
140
|
+
/**
|
|
141
|
+
* Data to be passed to the dialog or popover Surface.
|
|
142
|
+
*/
|
|
143
|
+
subject: S.optional(S.Any),
|
|
144
|
+
/**
|
|
145
|
+
* Anchor ID for the popover.
|
|
146
|
+
*/
|
|
147
|
+
anchorId: S.optional(S.String),
|
|
148
|
+
// TODO(wittjosiah): Custom properties?
|
|
149
|
+
/**
|
|
150
|
+
* Block alignment for the dialog.
|
|
151
|
+
*/
|
|
152
|
+
dialogBlockAlign: S.optional(S.Literal("start", "center")),
|
|
153
|
+
/**
|
|
154
|
+
* Type of dialog.
|
|
155
|
+
*/
|
|
156
|
+
dialogType: S.optional(S.Literal("default", "alert"))
|
|
157
|
+
}),
|
|
158
|
+
output: S.Void
|
|
159
|
+
}) {
|
|
160
|
+
}
|
|
161
|
+
LayoutAction2.SetLayout = SetLayout;
|
|
162
|
+
class SetLayoutMode extends S.TaggedClass()(`${LAYOUT_ACTION}/set-layout-mode`, {
|
|
163
|
+
input: S.Union(S.Struct({
|
|
164
|
+
layoutMode: LayoutMode
|
|
165
|
+
}), S.Struct({
|
|
166
|
+
revert: S.Literal(true)
|
|
167
|
+
})),
|
|
168
|
+
output: S.Void
|
|
169
|
+
}) {
|
|
170
|
+
}
|
|
171
|
+
LayoutAction2.SetLayoutMode = SetLayoutMode;
|
|
172
|
+
class ScrollIntoView extends S.TaggedClass()(`${LAYOUT_ACTION}/scroll-into-view`, {
|
|
173
|
+
input: S.Struct({
|
|
174
|
+
id: S.optional(S.String),
|
|
175
|
+
// TODO(wittjosiah): Factor out to thread scroll into view action?
|
|
176
|
+
cursor: S.optional(S.String),
|
|
177
|
+
ref: S.optional(S.String)
|
|
178
|
+
}),
|
|
179
|
+
output: S.Void
|
|
180
|
+
}) {
|
|
181
|
+
}
|
|
182
|
+
LayoutAction2.ScrollIntoView = ScrollIntoView;
|
|
125
183
|
})(LayoutAction || (LayoutAction = {}));
|
|
126
184
|
|
|
127
185
|
// packages/sdk/app-framework/src/plugins/common/metadata.ts
|
|
@@ -133,54 +191,53 @@ var parseMetadataResolverPlugin = (plugin) => {
|
|
|
133
191
|
};
|
|
134
192
|
|
|
135
193
|
// packages/sdk/app-framework/src/plugins/common/navigation.ts
|
|
136
|
-
import { Schema as
|
|
137
|
-
import { z as z2 } from "zod";
|
|
194
|
+
import { Schema as S2 } from "@effect/schema";
|
|
138
195
|
import { pick } from "@dxos/util";
|
|
139
196
|
var SLUG_LIST_SEPARATOR = "+";
|
|
140
197
|
var SLUG_ENTRY_SEPARATOR = "_";
|
|
141
198
|
var SLUG_KEY_VALUE_SEPARATOR = "-";
|
|
142
199
|
var SLUG_PATH_SEPARATOR = "~";
|
|
143
200
|
var SLUG_COLLECTION_INDICATOR = "";
|
|
144
|
-
var LayoutEntrySchema =
|
|
145
|
-
id:
|
|
146
|
-
path:
|
|
201
|
+
var LayoutEntrySchema = S2.mutable(S2.Struct({
|
|
202
|
+
id: S2.String,
|
|
203
|
+
path: S2.optional(S2.String)
|
|
147
204
|
}));
|
|
148
|
-
var LayoutPartSchema =
|
|
149
|
-
var LayoutPartsSchema =
|
|
205
|
+
var LayoutPartSchema = S2.Union(S2.Literal("sidebar"), S2.Literal("main"), S2.Literal("solo"), S2.Literal("complementary"), S2.Literal("fullScreen"));
|
|
206
|
+
var LayoutPartsSchema = S2.partial(S2.mutable(S2.Record({
|
|
150
207
|
key: LayoutPartSchema,
|
|
151
|
-
value:
|
|
208
|
+
value: S2.mutable(S2.Array(LayoutEntrySchema))
|
|
152
209
|
})));
|
|
153
|
-
var LayoutCoordinateSchema =
|
|
210
|
+
var LayoutCoordinateSchema = S2.mutable(S2.Struct({
|
|
154
211
|
part: LayoutPartSchema,
|
|
155
|
-
entryId:
|
|
212
|
+
entryId: S2.String
|
|
156
213
|
}));
|
|
157
|
-
var PartAdjustmentSchema =
|
|
158
|
-
var LayoutAdjustmentSchema =
|
|
214
|
+
var PartAdjustmentSchema = S2.Union(S2.Literal("increment-start"), S2.Literal("increment-end"), S2.Literal("pin-start"), S2.Literal("pin-end"), S2.Literal("close"), S2.Literal("solo"));
|
|
215
|
+
var LayoutAdjustmentSchema = S2.mutable(S2.Struct({
|
|
159
216
|
layoutCoordinate: LayoutCoordinateSchema,
|
|
160
217
|
type: PartAdjustmentSchema
|
|
161
218
|
}));
|
|
162
|
-
var ActiveParts =
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
var LocationProvidesSchema =
|
|
167
|
-
location:
|
|
219
|
+
var ActiveParts = S2.Record({
|
|
220
|
+
key: S2.String,
|
|
221
|
+
value: S2.Union(S2.String, S2.mutable(S2.Array(S2.String)))
|
|
222
|
+
});
|
|
223
|
+
var LocationProvidesSchema = S2.mutable(S2.Struct({
|
|
224
|
+
location: S2.Struct({
|
|
168
225
|
active: LayoutPartsSchema,
|
|
169
|
-
closed:
|
|
226
|
+
closed: S2.Array(S2.String)
|
|
170
227
|
})
|
|
171
228
|
}));
|
|
172
229
|
var isLayoutParts = (value) => {
|
|
173
|
-
return
|
|
230
|
+
return S2.is(LayoutPartsSchema)(value);
|
|
174
231
|
};
|
|
175
232
|
var isLayoutAdjustment = (value) => {
|
|
176
|
-
return
|
|
233
|
+
return S2.is(LayoutAdjustmentSchema)(value);
|
|
177
234
|
};
|
|
178
235
|
var parseNavigationPlugin = (plugin) => {
|
|
179
236
|
const location = plugin.provides?.location;
|
|
180
237
|
if (!location) {
|
|
181
238
|
return void 0;
|
|
182
239
|
}
|
|
183
|
-
if (
|
|
240
|
+
if (S2.is(LocationProvidesSchema)({
|
|
184
241
|
location
|
|
185
242
|
})) {
|
|
186
243
|
return plugin;
|
|
@@ -213,37 +270,75 @@ var NAVIGATION_PLUGIN = "dxos.org/plugin/navigation";
|
|
|
213
270
|
var NAVIGATION_ACTION = `${NAVIGATION_PLUGIN}/action`;
|
|
214
271
|
var NavigationAction;
|
|
215
272
|
(function(NavigationAction2) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
273
|
+
class Open extends S2.TaggedClass()(`${NAVIGATION_ACTION}/open`, {
|
|
274
|
+
input: S2.Struct({
|
|
275
|
+
activeParts: ActiveParts,
|
|
276
|
+
noToggle: S2.optional(S2.Boolean)
|
|
277
|
+
}),
|
|
278
|
+
output: S2.Struct({
|
|
279
|
+
open: S2.Array(S2.String)
|
|
280
|
+
})
|
|
281
|
+
}) {
|
|
282
|
+
}
|
|
283
|
+
NavigationAction2.Open = Open;
|
|
284
|
+
class AddToActive extends S2.TaggedClass()(`${NAVIGATION_ACTION}/add-to-active`, {
|
|
285
|
+
input: S2.Struct({
|
|
286
|
+
id: S2.String,
|
|
287
|
+
part: LayoutPartSchema,
|
|
288
|
+
scrollIntoView: S2.optional(S2.Boolean),
|
|
289
|
+
pivotId: S2.optional(S2.String),
|
|
290
|
+
positioning: S2.optional(S2.Literal("start", "end"))
|
|
291
|
+
}),
|
|
292
|
+
output: S2.Void
|
|
293
|
+
}) {
|
|
294
|
+
}
|
|
295
|
+
NavigationAction2.AddToActive = AddToActive;
|
|
296
|
+
class Set extends S2.TaggedClass()(`${NAVIGATION_ACTION}/set`, {
|
|
297
|
+
input: S2.Struct({
|
|
298
|
+
activeParts: ActiveParts
|
|
299
|
+
}),
|
|
300
|
+
output: S2.Void
|
|
301
|
+
}) {
|
|
302
|
+
}
|
|
303
|
+
NavigationAction2.Set = Set;
|
|
304
|
+
class Close extends S2.TaggedClass()(`${NAVIGATION_ACTION}/close`, {
|
|
305
|
+
input: S2.Struct({
|
|
306
|
+
activeParts: ActiveParts,
|
|
307
|
+
noToggle: S2.optional(S2.Boolean)
|
|
308
|
+
}),
|
|
309
|
+
output: S2.Void
|
|
310
|
+
}) {
|
|
311
|
+
}
|
|
312
|
+
NavigationAction2.Close = Close;
|
|
313
|
+
class Adjust extends S2.TaggedClass()(`${NAVIGATION_ACTION}/adjust`, {
|
|
314
|
+
input: LayoutAdjustmentSchema,
|
|
315
|
+
output: S2.Void
|
|
316
|
+
}) {
|
|
317
|
+
}
|
|
318
|
+
NavigationAction2.Adjust = Adjust;
|
|
319
|
+
class Expose extends S2.TaggedClass()(`${NAVIGATION_ACTION}/expose`, {
|
|
320
|
+
input: S2.Struct({
|
|
321
|
+
id: S2.String
|
|
322
|
+
}),
|
|
323
|
+
output: S2.Void
|
|
324
|
+
}) {
|
|
325
|
+
}
|
|
326
|
+
NavigationAction2.Expose = Expose;
|
|
222
327
|
})(NavigationAction || (NavigationAction = {}));
|
|
223
328
|
|
|
224
329
|
// packages/sdk/app-framework/src/plugins/common/translations.ts
|
|
225
|
-
import { z
|
|
226
|
-
var ResourceKey =
|
|
227
|
-
|
|
228
|
-
|
|
330
|
+
import { z } from "zod";
|
|
331
|
+
var ResourceKey = z.union([
|
|
332
|
+
z.string(),
|
|
333
|
+
z.record(z.any())
|
|
229
334
|
]);
|
|
230
|
-
var ResourceLanguage =
|
|
231
|
-
var Resource =
|
|
335
|
+
var ResourceLanguage = z.record(ResourceKey);
|
|
336
|
+
var Resource = z.record(ResourceLanguage);
|
|
232
337
|
var parseTranslationsPlugin = (plugin) => {
|
|
233
|
-
const { success } =
|
|
338
|
+
const { success } = z.array(Resource).safeParse(plugin.provides.translations);
|
|
234
339
|
return success ? plugin : void 0;
|
|
235
340
|
};
|
|
236
341
|
|
|
237
|
-
// packages/sdk/app-framework/src/plugins/plugin-host/plugin.ts
|
|
238
|
-
var Plugin;
|
|
239
|
-
(function(Plugin2) {
|
|
240
|
-
Plugin2.lazy = (p, props) => {
|
|
241
|
-
return () => p().then(({ default: definition }) => {
|
|
242
|
-
return definition(props);
|
|
243
|
-
});
|
|
244
|
-
};
|
|
245
|
-
})(Plugin || (Plugin = {}));
|
|
246
|
-
|
|
247
342
|
// packages/sdk/app-framework/src/plugins/plugin-host/HostPlugin.tsx
|
|
248
343
|
import React2 from "react";
|
|
249
344
|
import { LocalStorageStore } from "@dxos/local-storage";
|
|
@@ -301,7 +396,9 @@ var PluginContainer = ({ plugins: definitions, core, state, placeholder }) => {
|
|
|
301
396
|
S: void 0,
|
|
302
397
|
C: (f, a) => f(...a)
|
|
303
398
|
});
|
|
304
|
-
await Promise.all(enabled.map((plugin) => plugin.ready?.(
|
|
399
|
+
await Promise.all(enabled.map((plugin) => plugin.ready?.({
|
|
400
|
+
plugins: initialized
|
|
401
|
+
})));
|
|
305
402
|
log("plugins ready", {
|
|
306
403
|
plugins: initialized
|
|
307
404
|
}, {
|
|
@@ -385,7 +482,6 @@ var useResolvePlugins = (predicate) => {
|
|
|
385
482
|
var PluginProvider = PluginContext.Provider;
|
|
386
483
|
|
|
387
484
|
// packages/sdk/app-framework/src/plugins/plugin-host/HostPlugin.tsx
|
|
388
|
-
var parsePluginHost = (plugin) => plugin.provides.plugins ? plugin : void 0;
|
|
389
485
|
var HOST_PLUGIN = "dxos.org/plugin/host";
|
|
390
486
|
var HostPlugin = ({ plugins, meta, core, defaults = [], fallback = DefaultFallback, placeholder = null }) => {
|
|
391
487
|
const state = new LocalStorageStore(HOST_PLUGIN, {
|
|
@@ -416,7 +512,6 @@ var HostPlugin = ({ plugins, meta, core, defaults = [], fallback = DefaultFallba
|
|
|
416
512
|
name: "Plugin host"
|
|
417
513
|
},
|
|
418
514
|
provides: {
|
|
419
|
-
plugins: state.values,
|
|
420
515
|
context: ({ children }) => {
|
|
421
516
|
return /* @__PURE__ */ React2.createElement(PluginProvider, {
|
|
422
517
|
value: state.values
|
|
@@ -449,6 +544,16 @@ var DefaultFallback = ({ error }) => {
|
|
|
449
544
|
}, error.message), /* @__PURE__ */ React2.createElement("pre", null, error.stack));
|
|
450
545
|
};
|
|
451
546
|
|
|
547
|
+
// packages/sdk/app-framework/src/plugins/plugin-host/plugin.ts
|
|
548
|
+
var Plugin;
|
|
549
|
+
(function(Plugin2) {
|
|
550
|
+
Plugin2.lazy = (p, props) => {
|
|
551
|
+
return () => p().then(({ default: definition }) => {
|
|
552
|
+
return definition(props);
|
|
553
|
+
});
|
|
554
|
+
};
|
|
555
|
+
})(Plugin || (Plugin = {}));
|
|
556
|
+
|
|
452
557
|
// packages/sdk/app-framework/src/App.tsx
|
|
453
558
|
import React3 from "react";
|
|
454
559
|
import { invariant } from "@dxos/invariant";
|
|
@@ -457,9 +562,9 @@ var createApp = ({ meta, plugins, core, ...params }) => {
|
|
|
457
562
|
const hostPlugin = HostPlugin({
|
|
458
563
|
plugins: {
|
|
459
564
|
...plugins,
|
|
460
|
-
[meta_default.id]: Plugin.lazy(() => import("./plugin-intent-
|
|
461
|
-
[meta_default3.id]: Plugin.lazy(() => import("./plugin-settings-
|
|
462
|
-
[meta_default2.id]: Plugin.lazy(() => import("./plugin-surface-
|
|
565
|
+
[meta_default.id]: Plugin.lazy(() => import("./plugin-intent-T7Y3MJ5C.mjs")),
|
|
566
|
+
[meta_default3.id]: Plugin.lazy(() => import("./plugin-settings-5U2L2NRU.mjs")),
|
|
567
|
+
[meta_default2.id]: Plugin.lazy(() => import("./plugin-surface-OKPF3EQI.mjs"))
|
|
463
568
|
},
|
|
464
569
|
meta: [
|
|
465
570
|
meta_default,
|
|
@@ -509,16 +614,24 @@ export {
|
|
|
509
614
|
ActiveParts,
|
|
510
615
|
ErrorBoundary,
|
|
511
616
|
HostPlugin,
|
|
617
|
+
INTENT_ACTION,
|
|
512
618
|
IntentAction,
|
|
513
619
|
IntentProvider,
|
|
620
|
+
LAYOUT_ACTION,
|
|
621
|
+
LAYOUT_PLUGIN,
|
|
622
|
+
Label,
|
|
514
623
|
Layout,
|
|
515
624
|
LayoutAction,
|
|
625
|
+
NAVIGATION_ACTION,
|
|
626
|
+
NAVIGATION_PLUGIN,
|
|
516
627
|
NavigationAction,
|
|
517
628
|
Plugin,
|
|
518
629
|
PluginProvider,
|
|
519
630
|
Resource,
|
|
520
631
|
ResourceKey,
|
|
521
632
|
ResourceLanguage,
|
|
633
|
+
SETTINGS_ACTION,
|
|
634
|
+
SETTINGS_PLUGIN,
|
|
522
635
|
SLUG_COLLECTION_INDICATOR,
|
|
523
636
|
SLUG_ENTRY_SEPARATOR,
|
|
524
637
|
SLUG_KEY_VALUE_SEPARATOR,
|
|
@@ -528,7 +641,12 @@ export {
|
|
|
528
641
|
Surface,
|
|
529
642
|
SurfaceProvider,
|
|
530
643
|
Toast,
|
|
644
|
+
chain,
|
|
531
645
|
createApp,
|
|
646
|
+
createDispatcher,
|
|
647
|
+
createIntent,
|
|
648
|
+
createResolver,
|
|
649
|
+
createSurface,
|
|
532
650
|
defaultFileTypes,
|
|
533
651
|
definePlugin,
|
|
534
652
|
filterPlugins,
|
|
@@ -551,21 +669,18 @@ export {
|
|
|
551
669
|
parseMetadataRecordsPlugin,
|
|
552
670
|
parseMetadataResolverPlugin,
|
|
553
671
|
parseNavigationPlugin,
|
|
554
|
-
parsePluginHost,
|
|
555
672
|
parseRootSurfacePlugin,
|
|
556
673
|
parseSettingsPlugin,
|
|
557
674
|
parseSurfacePlugin,
|
|
558
675
|
parseTranslationsPlugin,
|
|
559
676
|
partLength,
|
|
560
677
|
resolvePlugin,
|
|
561
|
-
useIntent,
|
|
562
678
|
useIntentDispatcher,
|
|
563
679
|
useIntentResolver,
|
|
564
680
|
usePlugin,
|
|
565
681
|
usePlugins,
|
|
566
682
|
useResolvePlugin,
|
|
567
683
|
useResolvePlugins,
|
|
568
|
-
useSurface,
|
|
569
684
|
useSurfaceRoot
|
|
570
685
|
};
|
|
571
686
|
//# sourceMappingURL=index.mjs.map
|