@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.
Files changed (128) hide show
  1. package/dist/lib/browser/chunk-QG25ZU2N.mjs +320 -0
  2. package/dist/lib/browser/chunk-QG25ZU2N.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-SPDTXTOV.mjs +163 -0
  4. package/dist/lib/browser/chunk-SPDTXTOV.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-653Y45CL.mjs → chunk-WBOXEHBE.mjs} +12 -2
  6. package/dist/lib/browser/chunk-WBOXEHBE.mjs.map +7 -0
  7. package/dist/lib/browser/index.mjs +224 -109
  8. package/dist/lib/browser/index.mjs.map +4 -4
  9. package/dist/lib/browser/meta.json +1 -1
  10. package/dist/lib/browser/{plugin-intent-LU4KL2RO.mjs → plugin-intent-T7Y3MJ5C.mjs} +14 -4
  11. package/dist/lib/browser/{plugin-settings-OM3G2QFY.mjs → plugin-settings-5U2L2NRU.mjs} +6 -2
  12. package/dist/lib/browser/{plugin-surface-LECZMKSQ.mjs → plugin-surface-OKPF3EQI.mjs} +4 -4
  13. package/dist/lib/node/{chunk-SOVLKUWI.cjs → chunk-BW3RNEVI.cjs} +51 -102
  14. package/dist/lib/node/chunk-BW3RNEVI.cjs.map +7 -0
  15. package/dist/lib/node/{chunk-JZ2JVKRY.cjs → chunk-FCMHRU3M.cjs} +17 -5
  16. package/dist/lib/node/chunk-FCMHRU3M.cjs.map +7 -0
  17. package/dist/lib/node/chunk-VWHAALIN.cjs +344 -0
  18. package/dist/lib/node/chunk-VWHAALIN.cjs.map +7 -0
  19. package/dist/lib/node/index.cjs +232 -114
  20. package/dist/lib/node/index.cjs.map +4 -4
  21. package/dist/lib/node/meta.json +1 -1
  22. package/dist/lib/node/plugin-intent-F3TQZIUR.cjs +53 -0
  23. package/dist/lib/node/plugin-intent-F3TQZIUR.cjs.map +7 -0
  24. package/dist/lib/node/{plugin-settings-OZ6IKAE5.cjs → plugin-settings-W6UHMH5M.cjs} +12 -8
  25. package/dist/lib/node/plugin-settings-W6UHMH5M.cjs.map +7 -0
  26. package/dist/lib/node/{plugin-surface-YWDRXQTD.cjs → plugin-surface-CCSIONYW.cjs} +15 -15
  27. package/dist/lib/node/plugin-surface-CCSIONYW.cjs.map +7 -0
  28. package/dist/lib/node-esm/{chunk-YNU7FTGJ.mjs → chunk-3T5UIJY3.mjs} +12 -2
  29. package/dist/lib/node-esm/chunk-3T5UIJY3.mjs.map +7 -0
  30. package/dist/lib/node-esm/chunk-4GX7V5ZE.mjs +164 -0
  31. package/dist/lib/node-esm/chunk-4GX7V5ZE.mjs.map +7 -0
  32. package/dist/lib/node-esm/chunk-CFOUYXQ6.mjs +321 -0
  33. package/dist/lib/node-esm/chunk-CFOUYXQ6.mjs.map +7 -0
  34. package/dist/lib/node-esm/index.mjs +224 -109
  35. package/dist/lib/node-esm/index.mjs.map +4 -4
  36. package/dist/lib/node-esm/meta.json +1 -1
  37. package/dist/lib/node-esm/{plugin-intent-V7ER24Y6.mjs → plugin-intent-W2HQC6LC.mjs} +14 -4
  38. package/dist/lib/node-esm/{plugin-settings-37UVWF2V.mjs → plugin-settings-H5RHNFVC.mjs} +6 -2
  39. package/dist/lib/node-esm/{plugin-surface-TEU42XQN.mjs → plugin-surface-V3YET3UL.mjs} +4 -4
  40. package/dist/types/src/plugins/common/layout.d.ts +145 -171
  41. package/dist/types/src/plugins/common/layout.d.ts.map +1 -1
  42. package/dist/types/src/plugins/common/navigation.d.ts +77 -30
  43. package/dist/types/src/plugins/common/navigation.d.ts.map +1 -1
  44. package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts +2 -7
  45. package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts.map +1 -1
  46. package/dist/types/src/plugins/plugin-host/index.d.ts +2 -0
  47. package/dist/types/src/plugins/plugin-host/index.d.ts.map +1 -1
  48. package/dist/types/src/plugins/plugin-host/plugin.d.ts +7 -1
  49. package/dist/types/src/plugins/plugin-host/plugin.d.ts.map +1 -1
  50. package/dist/types/src/plugins/plugin-intent/IntentContext.d.ts +7 -20
  51. package/dist/types/src/plugins/plugin-intent/IntentContext.d.ts.map +1 -1
  52. package/dist/types/src/plugins/plugin-intent/IntentPlugin.d.ts.map +1 -1
  53. package/dist/types/src/plugins/plugin-intent/index.d.ts +1 -0
  54. package/dist/types/src/plugins/plugin-intent/index.d.ts.map +1 -1
  55. package/dist/types/src/plugins/plugin-intent/intent-dispatcher.d.ts +107 -0
  56. package/dist/types/src/plugins/plugin-intent/intent-dispatcher.d.ts.map +1 -0
  57. package/dist/types/src/plugins/plugin-intent/intent-dispatcher.test.d.ts +2 -0
  58. package/dist/types/src/plugins/plugin-intent/intent-dispatcher.test.d.ts.map +1 -0
  59. package/dist/types/src/plugins/plugin-intent/intent.d.ts +65 -58
  60. package/dist/types/src/plugins/plugin-intent/intent.d.ts.map +1 -1
  61. package/dist/types/src/plugins/plugin-intent/meta.d.ts +1 -0
  62. package/dist/types/src/plugins/plugin-intent/meta.d.ts.map +1 -1
  63. package/dist/types/src/plugins/plugin-intent/provides.d.ts +6 -10
  64. package/dist/types/src/plugins/plugin-intent/provides.d.ts.map +1 -1
  65. package/dist/types/src/plugins/plugin-settings/provides.d.ts +15 -2
  66. package/dist/types/src/plugins/plugin-settings/provides.d.ts.map +1 -1
  67. package/dist/types/src/plugins/plugin-surface/Surface.d.ts +2 -57
  68. package/dist/types/src/plugins/plugin-surface/Surface.d.ts.map +1 -1
  69. package/dist/types/src/plugins/plugin-surface/SurfaceContext.d.ts +85 -0
  70. package/dist/types/src/plugins/plugin-surface/SurfaceContext.d.ts.map +1 -0
  71. package/dist/types/src/plugins/plugin-surface/SurfacePlugin.d.ts.map +1 -1
  72. package/dist/types/src/plugins/plugin-surface/index.d.ts +1 -1
  73. package/dist/types/src/plugins/plugin-surface/index.d.ts.map +1 -1
  74. package/dist/types/src/plugins/plugin-surface/provides.d.ts +5 -4
  75. package/dist/types/src/plugins/plugin-surface/provides.d.ts.map +1 -1
  76. package/dist/types/tsconfig.tsbuildinfo +1 -0
  77. package/package.json +14 -12
  78. package/src/plugins/common/layout.ts +125 -107
  79. package/src/plugins/common/navigation.ts +59 -30
  80. package/src/plugins/plugin-host/HostPlugin.tsx +2 -10
  81. package/src/plugins/plugin-host/PluginContainer.tsx +1 -1
  82. package/src/plugins/plugin-host/index.ts +4 -0
  83. package/src/plugins/plugin-host/plugin.ts +8 -1
  84. package/src/plugins/plugin-intent/IntentContext.tsx +13 -36
  85. package/src/plugins/plugin-intent/IntentPlugin.tsx +44 -120
  86. package/src/plugins/plugin-intent/index.ts +1 -0
  87. package/src/plugins/plugin-intent/intent-dispatcher.test.ts +279 -0
  88. package/src/plugins/plugin-intent/intent-dispatcher.ts +285 -0
  89. package/src/plugins/plugin-intent/intent.ts +126 -65
  90. package/src/plugins/plugin-intent/meta.ts +3 -1
  91. package/src/plugins/plugin-intent/provides.ts +8 -20
  92. package/src/plugins/plugin-settings/provides.ts +10 -5
  93. package/src/plugins/plugin-surface/Surface.tsx +25 -158
  94. package/src/plugins/plugin-surface/SurfaceContext.ts +112 -0
  95. package/src/plugins/plugin-surface/SurfacePlugin.tsx +19 -7
  96. package/src/plugins/plugin-surface/index.ts +1 -1
  97. package/src/plugins/plugin-surface/provides.ts +8 -7
  98. package/tsconfig.json +38 -1
  99. package/dist/lib/browser/chunk-653Y45CL.mjs.map +0 -7
  100. package/dist/lib/browser/chunk-FRXJ25VI.mjs +0 -214
  101. package/dist/lib/browser/chunk-FRXJ25VI.mjs.map +0 -7
  102. package/dist/lib/browser/chunk-YXM35XRE.mjs +0 -213
  103. package/dist/lib/browser/chunk-YXM35XRE.mjs.map +0 -7
  104. package/dist/lib/node/chunk-JZ2JVKRY.cjs.map +0 -7
  105. package/dist/lib/node/chunk-QSVP5HOW.cjs +0 -238
  106. package/dist/lib/node/chunk-QSVP5HOW.cjs.map +0 -7
  107. package/dist/lib/node/chunk-SOVLKUWI.cjs.map +0 -7
  108. package/dist/lib/node/plugin-intent-FVFR2LKB.cjs +0 -43
  109. package/dist/lib/node/plugin-intent-FVFR2LKB.cjs.map +0 -7
  110. package/dist/lib/node/plugin-settings-OZ6IKAE5.cjs.map +0 -7
  111. package/dist/lib/node/plugin-surface-YWDRXQTD.cjs.map +0 -7
  112. package/dist/lib/node-esm/chunk-2R4GVK7O.mjs +0 -215
  113. package/dist/lib/node-esm/chunk-2R4GVK7O.mjs.map +0 -7
  114. package/dist/lib/node-esm/chunk-YFMFQBB4.mjs +0 -214
  115. package/dist/lib/node-esm/chunk-YFMFQBB4.mjs.map +0 -7
  116. package/dist/lib/node-esm/chunk-YNU7FTGJ.mjs.map +0 -7
  117. package/dist/types/src/plugins/plugin-intent/helpers.d.ts +0 -6
  118. package/dist/types/src/plugins/plugin-intent/helpers.d.ts.map +0 -1
  119. package/dist/types/src/plugins/plugin-surface/SurfaceRootContext.d.ts +0 -39
  120. package/dist/types/src/plugins/plugin-surface/SurfaceRootContext.d.ts.map +0 -1
  121. package/src/plugins/plugin-intent/helpers.ts +0 -11
  122. package/src/plugins/plugin-surface/SurfaceRootContext.tsx +0 -60
  123. /package/dist/lib/browser/{plugin-intent-LU4KL2RO.mjs.map → plugin-intent-T7Y3MJ5C.mjs.map} +0 -0
  124. /package/dist/lib/browser/{plugin-settings-OM3G2QFY.mjs.map → plugin-settings-5U2L2NRU.mjs.map} +0 -0
  125. /package/dist/lib/browser/{plugin-surface-LECZMKSQ.mjs.map → plugin-surface-OKPF3EQI.mjs.map} +0 -0
  126. /package/dist/lib/node-esm/{plugin-intent-V7ER24Y6.mjs.map → plugin-intent-W2HQC6LC.mjs.map} +0 -0
  127. /package/dist/lib/node-esm/{plugin-settings-37UVWF2V.mjs.map → plugin-settings-H5RHNFVC.mjs.map} +0 -0
  128. /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-YXM35XRE.mjs";
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-FRXJ25VI.mjs";
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-653Y45CL.mjs";
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 { z } from "zod";
66
- var Toast = z.object({
67
- id: z.string(),
68
- title: z.string().optional(),
69
- description: z.string().optional(),
70
- // TODO(wittjosiah): `icon` should be string to be parsed by an `Icon` component.
71
- icon: z.any().optional(),
72
- duration: z.number().optional(),
73
- closeLabel: z.string().optional(),
74
- actionLabel: z.string().optional(),
75
- actionAlt: z.string().optional(),
76
- onAction: z.function().optional()
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 = z.union([
79
- z.literal("deck"),
80
- z.literal("solo"),
81
- z.literal("fullscreen")
82
- ]);
83
- var isLayoutMode = (value) => LayoutMode.safeParse(value).success;
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
- * @deprecated
94
- */
95
- complementarySidebarContent: z.any().optional().describe("DEPRECATED. Data to be passed to the complementary sidebar Surface."),
96
- dialogOpen: z.boolean(),
97
- dialogContent: z.any().optional().describe("Data to be passed to the dialog Surface."),
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: z.union([
100
- z.literal("start"),
101
- z.literal("center")
102
- ]).optional(),
103
- dialogType: z.union([
104
- z.literal("default"),
105
- z.literal("alert")
106
- ]).optional(),
107
- popoverOpen: z.boolean(),
108
- popoverContent: z.any().optional().describe("Data to be passed to the popover Surface."),
109
- popoverAnchorId: z.string().optional(),
110
- toasts: z.array(Toast),
111
- scrollIntoView: z.string().optional().describe("The identifier of a component to scroll into view when it is mounted.")
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 { success } = Layout.safeParse(plugin.provides.layout);
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
- LayoutAction2[LayoutAction2["SET_LAYOUT"] = `${LAYOUT_ACTION}/set-layout`] = "SET_LAYOUT";
122
- LayoutAction2[LayoutAction2["SET_LAYOUT_MODE"] = `${LAYOUT_ACTION}/set-layout-mode`] = "SET_LAYOUT_MODE";
123
- LayoutAction2[LayoutAction2["SCROLL_INTO_VIEW"] = `${LAYOUT_ACTION}/scroll-into-view`] = "SCROLL_INTO_VIEW";
124
- LayoutAction2[LayoutAction2["UPDATE_PLANK_SIZE"] = `${LAYOUT_ACTION}/update-plank-size`] = "UPDATE_PLANK_SIZE";
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 S } from "@effect/schema";
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 = S.mutable(S.Struct({
145
- id: S.String,
146
- path: S.optional(S.String)
201
+ var LayoutEntrySchema = S2.mutable(S2.Struct({
202
+ id: S2.String,
203
+ path: S2.optional(S2.String)
147
204
  }));
148
- var LayoutPartSchema = S.Union(S.Literal("sidebar"), S.Literal("main"), S.Literal("solo"), S.Literal("complementary"), S.Literal("fullScreen"));
149
- var LayoutPartsSchema = S.partial(S.mutable(S.Record({
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: S.mutable(S.Array(LayoutEntrySchema))
208
+ value: S2.mutable(S2.Array(LayoutEntrySchema))
152
209
  })));
153
- var LayoutCoordinateSchema = S.mutable(S.Struct({
210
+ var LayoutCoordinateSchema = S2.mutable(S2.Struct({
154
211
  part: LayoutPartSchema,
155
- entryId: S.String
212
+ entryId: S2.String
156
213
  }));
157
- var PartAdjustmentSchema = S.Union(S.Literal("increment-start"), S.Literal("increment-end"), S.Literal("solo"));
158
- var LayoutAdjustmentSchema = S.mutable(S.Struct({
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 = z2.record(z2.string(), z2.union([
163
- z2.string(),
164
- z2.array(z2.string())
165
- ]));
166
- var LocationProvidesSchema = S.mutable(S.Struct({
167
- location: S.Struct({
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: S.Array(S.String)
226
+ closed: S2.Array(S2.String)
170
227
  })
171
228
  }));
172
229
  var isLayoutParts = (value) => {
173
- return S.is(LayoutPartsSchema)(value);
230
+ return S2.is(LayoutPartsSchema)(value);
174
231
  };
175
232
  var isLayoutAdjustment = (value) => {
176
- return S.is(LayoutAdjustmentSchema)(value);
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 (S.is(LocationProvidesSchema)({
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
- NavigationAction2[NavigationAction2["OPEN"] = `${NAVIGATION_ACTION}/open`] = "OPEN";
217
- NavigationAction2[NavigationAction2["ADD_TO_ACTIVE"] = `${NAVIGATION_ACTION}/add-to-active`] = "ADD_TO_ACTIVE";
218
- NavigationAction2[NavigationAction2["SET"] = `${NAVIGATION_ACTION}/set`] = "SET";
219
- NavigationAction2[NavigationAction2["ADJUST"] = `${NAVIGATION_ACTION}/adjust`] = "ADJUST";
220
- NavigationAction2[NavigationAction2["CLOSE"] = `${NAVIGATION_ACTION}/close`] = "CLOSE";
221
- NavigationAction2[NavigationAction2["EXPOSE"] = `${NAVIGATION_ACTION}/expose`] = "EXPOSE";
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 as z3 } from "zod";
226
- var ResourceKey = z3.union([
227
- z3.string(),
228
- z3.record(z3.any())
330
+ import { z } from "zod";
331
+ var ResourceKey = z.union([
332
+ z.string(),
333
+ z.record(z.any())
229
334
  ]);
230
- var ResourceLanguage = z3.record(ResourceKey);
231
- var Resource = z3.record(ResourceLanguage);
335
+ var ResourceLanguage = z.record(ResourceKey);
336
+ var Resource = z.record(ResourceLanguage);
232
337
  var parseTranslationsPlugin = (plugin) => {
233
- const { success } = z3.array(Resource).safeParse(plugin.provides.translations);
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?.(initialized)));
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-LU4KL2RO.mjs")),
461
- [meta_default3.id]: Plugin.lazy(() => import("./plugin-settings-OM3G2QFY.mjs")),
462
- [meta_default2.id]: Plugin.lazy(() => import("./plugin-surface-LECZMKSQ.mjs"))
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