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