@dxos/app-framework 0.7.4 → 0.7.5-main.499c70c

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,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-YFMFQBB4.mjs";
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-2R4GVK7O.mjs";
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-YNU7FTGJ.mjs";
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 { z } from "zod";
67
- var Toast = z.object({
68
- id: z.string(),
69
- title: z.string().optional(),
70
- description: z.string().optional(),
71
- // TODO(wittjosiah): `icon` should be string to be parsed by an `Icon` component.
72
- icon: z.any().optional(),
73
- duration: z.number().optional(),
74
- closeLabel: z.string().optional(),
75
- actionLabel: z.string().optional(),
76
- actionAlt: z.string().optional(),
77
- onAction: z.function().optional()
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 = z.union([
80
- z.literal("deck"),
81
- z.literal("solo"),
82
- z.literal("fullscreen")
83
- ]);
84
- var isLayoutMode = (value) => LayoutMode.safeParse(value).success;
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
- * @deprecated
95
- */
96
- complementarySidebarContent: z.any().optional().describe("DEPRECATED. Data to be passed to the complementary sidebar Surface."),
97
- dialogOpen: z.boolean(),
98
- dialogContent: z.any().optional().describe("Data to be passed to the dialog Surface."),
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: z.union([
101
- z.literal("start"),
102
- z.literal("center")
103
- ]).optional(),
104
- dialogType: z.union([
105
- z.literal("default"),
106
- z.literal("alert")
107
- ]).optional(),
108
- popoverOpen: z.boolean(),
109
- popoverContent: z.any().optional().describe("Data to be passed to the popover Surface."),
110
- popoverAnchorId: z.string().optional(),
111
- toasts: z.array(Toast),
112
- scrollIntoView: z.string().optional().describe("The identifier of a component to scroll into view when it is mounted.")
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 { success } = Layout.safeParse(plugin.provides.layout);
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
- LayoutAction2[LayoutAction2["SET_LAYOUT"] = `${LAYOUT_ACTION}/set-layout`] = "SET_LAYOUT";
123
- LayoutAction2[LayoutAction2["SET_LAYOUT_MODE"] = `${LAYOUT_ACTION}/set-layout-mode`] = "SET_LAYOUT_MODE";
124
- LayoutAction2[LayoutAction2["SCROLL_INTO_VIEW"] = `${LAYOUT_ACTION}/scroll-into-view`] = "SCROLL_INTO_VIEW";
125
- LayoutAction2[LayoutAction2["UPDATE_PLANK_SIZE"] = `${LAYOUT_ACTION}/update-plank-size`] = "UPDATE_PLANK_SIZE";
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 S } from "@effect/schema";
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 = S.mutable(S.Struct({
146
- id: S.String,
147
- path: S.optional(S.String)
202
+ var LayoutEntrySchema = S2.mutable(S2.Struct({
203
+ id: S2.String,
204
+ path: S2.optional(S2.String)
148
205
  }));
149
- var LayoutPartSchema = S.Union(S.Literal("sidebar"), S.Literal("main"), S.Literal("solo"), S.Literal("complementary"), S.Literal("fullScreen"));
150
- var LayoutPartsSchema = S.partial(S.mutable(S.Record({
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: S.mutable(S.Array(LayoutEntrySchema))
209
+ value: S2.mutable(S2.Array(LayoutEntrySchema))
153
210
  })));
154
- var LayoutCoordinateSchema = S.mutable(S.Struct({
211
+ var LayoutCoordinateSchema = S2.mutable(S2.Struct({
155
212
  part: LayoutPartSchema,
156
- entryId: S.String
213
+ entryId: S2.String
157
214
  }));
158
- var PartAdjustmentSchema = S.Union(S.Literal("increment-start"), S.Literal("increment-end"), S.Literal("solo"));
159
- var LayoutAdjustmentSchema = S.mutable(S.Struct({
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 = z2.record(z2.string(), z2.union([
164
- z2.string(),
165
- z2.array(z2.string())
166
- ]));
167
- var LocationProvidesSchema = S.mutable(S.Struct({
168
- location: S.Struct({
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: S.Array(S.String)
227
+ closed: S2.Array(S2.String)
171
228
  })
172
229
  }));
173
230
  var isLayoutParts = (value) => {
174
- return S.is(LayoutPartsSchema)(value);
231
+ return S2.is(LayoutPartsSchema)(value);
175
232
  };
176
233
  var isLayoutAdjustment = (value) => {
177
- return S.is(LayoutAdjustmentSchema)(value);
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 (S.is(LocationProvidesSchema)({
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
- NavigationAction2[NavigationAction2["OPEN"] = `${NAVIGATION_ACTION}/open`] = "OPEN";
218
- NavigationAction2[NavigationAction2["ADD_TO_ACTIVE"] = `${NAVIGATION_ACTION}/add-to-active`] = "ADD_TO_ACTIVE";
219
- NavigationAction2[NavigationAction2["SET"] = `${NAVIGATION_ACTION}/set`] = "SET";
220
- NavigationAction2[NavigationAction2["ADJUST"] = `${NAVIGATION_ACTION}/adjust`] = "ADJUST";
221
- NavigationAction2[NavigationAction2["CLOSE"] = `${NAVIGATION_ACTION}/close`] = "CLOSE";
222
- NavigationAction2[NavigationAction2["EXPOSE"] = `${NAVIGATION_ACTION}/expose`] = "EXPOSE";
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 as z3 } from "zod";
227
- var ResourceKey = z3.union([
228
- z3.string(),
229
- z3.record(z3.any())
331
+ import { z } from "zod";
332
+ var ResourceKey = z.union([
333
+ z.string(),
334
+ z.record(z.any())
230
335
  ]);
231
- var ResourceLanguage = z3.record(ResourceKey);
232
- var Resource = z3.record(ResourceLanguage);
336
+ var ResourceLanguage = z.record(ResourceKey);
337
+ var Resource = z.record(ResourceLanguage);
233
338
  var parseTranslationsPlugin = (plugin) => {
234
- const { success } = z3.array(Resource).safeParse(plugin.provides.translations);
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?.(initialized)));
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-V7ER24Y6.mjs")),
462
- [meta_default3.id]: Plugin.lazy(() => import("./plugin-settings-37UVWF2V.mjs")),
463
- [meta_default2.id]: Plugin.lazy(() => import("./plugin-surface-TEU42XQN.mjs"))
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