@dxos/app-framework 0.7.5-main.9d2a38b → 0.7.5-main.e9bb01b

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 (181) hide show
  1. package/dist/lib/browser/app-graph-builder-F7VZ6LRN.mjs +137 -0
  2. package/dist/lib/browser/app-graph-builder-F7VZ6LRN.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-GNLU3GAU.mjs → chunk-ATRNTMSS.mjs} +623 -819
  4. package/dist/lib/browser/chunk-ATRNTMSS.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-LDJ3T4V3.mjs +32 -0
  6. package/dist/lib/browser/chunk-LDJ3T4V3.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-WS6SU6HI.mjs +285 -0
  8. package/dist/lib/browser/chunk-WS6SU6HI.mjs.map +7 -0
  9. package/dist/lib/browser/index.mjs +57 -74
  10. package/dist/lib/browser/index.mjs.map +4 -4
  11. package/dist/lib/browser/intent-dispatcher-E6J7E5Y5.mjs +11 -0
  12. package/dist/lib/browser/intent-dispatcher-E6J7E5Y5.mjs.map +7 -0
  13. package/dist/lib/browser/intent-resolver-XLE4L3LS.mjs +38 -0
  14. package/dist/lib/browser/intent-resolver-XLE4L3LS.mjs.map +7 -0
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/store-QU2IKFAI.mjs +19 -0
  17. package/dist/lib/browser/store-QU2IKFAI.mjs.map +7 -0
  18. package/dist/lib/browser/testing/index.mjs +10 -3
  19. package/dist/lib/browser/testing/index.mjs.map +3 -3
  20. package/dist/lib/browser/worker.mjs +77 -0
  21. package/dist/lib/browser/worker.mjs.map +7 -0
  22. package/dist/lib/node/app-graph-builder-JGBADFF7.cjs +146 -0
  23. package/dist/lib/node/app-graph-builder-JGBADFF7.cjs.map +7 -0
  24. package/dist/lib/node/chunk-QLVQ6PND.cjs +58 -0
  25. package/dist/lib/node/chunk-QLVQ6PND.cjs.map +7 -0
  26. package/dist/lib/node/chunk-WKC6YMEQ.cjs +1433 -0
  27. package/dist/lib/node/chunk-WKC6YMEQ.cjs.map +7 -0
  28. package/dist/lib/node/chunk-WRWRZKZU.cjs +308 -0
  29. package/dist/lib/node/chunk-WRWRZKZU.cjs.map +7 -0
  30. package/dist/lib/node/index.cjs +106 -118
  31. package/dist/lib/node/index.cjs.map +4 -4
  32. package/dist/lib/node/intent-dispatcher-CFBKDZQR.cjs +32 -0
  33. package/dist/lib/node/intent-dispatcher-CFBKDZQR.cjs.map +7 -0
  34. package/dist/lib/node/intent-resolver-3TKCXP4S.cjs +45 -0
  35. package/dist/lib/node/intent-resolver-3TKCXP4S.cjs.map +7 -0
  36. package/dist/lib/node/meta.json +1 -1
  37. package/dist/lib/node/store-4QMUUU2A.cjs +34 -0
  38. package/dist/lib/node/store-4QMUUU2A.cjs.map +7 -0
  39. package/dist/lib/node/testing/index.cjs +15 -8
  40. package/dist/lib/node/testing/index.cjs.map +3 -3
  41. package/dist/lib/node/worker.cjs +99 -0
  42. package/dist/lib/node/worker.cjs.map +7 -0
  43. package/dist/lib/node-esm/app-graph-builder-2QEX57NX.mjs +138 -0
  44. package/dist/lib/node-esm/app-graph-builder-2QEX57NX.mjs.map +7 -0
  45. package/dist/lib/node-esm/{chunk-KPMTPXQI.mjs → chunk-44J2VZBB.mjs} +623 -819
  46. package/dist/lib/node-esm/chunk-44J2VZBB.mjs.map +7 -0
  47. package/dist/lib/node-esm/chunk-CNJYZNSL.mjs +34 -0
  48. package/dist/lib/node-esm/chunk-CNJYZNSL.mjs.map +7 -0
  49. package/dist/lib/node-esm/chunk-HTLXL32I.mjs +286 -0
  50. package/dist/lib/node-esm/chunk-HTLXL32I.mjs.map +7 -0
  51. package/dist/lib/node-esm/index.mjs +57 -74
  52. package/dist/lib/node-esm/index.mjs.map +4 -4
  53. package/dist/lib/node-esm/intent-dispatcher-LDQGDZ62.mjs +12 -0
  54. package/dist/lib/node-esm/intent-dispatcher-LDQGDZ62.mjs.map +7 -0
  55. package/dist/lib/node-esm/intent-resolver-7VJWN67U.mjs +39 -0
  56. package/dist/lib/node-esm/intent-resolver-7VJWN67U.mjs.map +7 -0
  57. package/dist/lib/node-esm/meta.json +1 -1
  58. package/dist/lib/node-esm/store-VWDAYUQY.mjs +20 -0
  59. package/dist/lib/node-esm/store-VWDAYUQY.mjs.map +7 -0
  60. package/dist/lib/node-esm/testing/index.mjs +10 -3
  61. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  62. package/dist/lib/node-esm/worker.mjs +78 -0
  63. package/dist/lib/node-esm/worker.mjs.map +7 -0
  64. package/dist/types/src/App.d.ts.map +1 -1
  65. package/dist/types/src/common/capabilities.d.ts +63 -110
  66. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  67. package/dist/types/src/common/events.d.ts +8 -1
  68. package/dist/types/src/common/events.d.ts.map +1 -1
  69. package/dist/types/src/common/file.d.ts +1 -1
  70. package/dist/types/src/common/file.d.ts.map +1 -1
  71. package/dist/types/src/common/graph.d.ts +2 -2
  72. package/dist/types/src/common/graph.d.ts.map +1 -1
  73. package/dist/types/src/common/index.d.ts +0 -1
  74. package/dist/types/src/common/index.d.ts.map +1 -1
  75. package/dist/types/src/common/layout.d.ts +204 -121
  76. package/dist/types/src/common/layout.d.ts.map +1 -1
  77. package/dist/types/src/common/surface.d.ts +3 -3
  78. package/dist/types/src/common/surface.d.ts.map +1 -1
  79. package/dist/types/src/common/translations.d.ts +7 -7
  80. package/dist/types/src/common/translations.d.ts.map +1 -1
  81. package/dist/types/src/core/capabilities.d.ts +6 -2
  82. package/dist/types/src/core/capabilities.d.ts.map +1 -1
  83. package/dist/types/src/core/manager.d.ts +2 -9
  84. package/dist/types/src/core/manager.d.ts.map +1 -1
  85. package/dist/types/src/core/plugin.d.ts +5 -2
  86. package/dist/types/src/core/plugin.d.ts.map +1 -1
  87. package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -1
  88. package/dist/types/src/playground/generator/generator.d.ts +2 -0
  89. package/dist/types/src/playground/generator/generator.d.ts.map +1 -1
  90. package/dist/types/src/playground/generator/plugin.d.ts.map +1 -1
  91. package/dist/types/src/playground/logger/Toolbar.d.ts.map +1 -1
  92. package/dist/types/src/playground/logger/plugin.d.ts.map +1 -1
  93. package/dist/types/src/playground/logger/schema.d.ts +1 -1
  94. package/dist/types/src/playground/logger/schema.d.ts.map +1 -1
  95. package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -1
  96. package/dist/types/src/plugin-intent/actions.d.ts +1 -1
  97. package/dist/types/src/plugin-intent/actions.d.ts.map +1 -1
  98. package/dist/types/src/plugin-intent/index.d.ts +0 -1
  99. package/dist/types/src/plugin-intent/index.d.ts.map +1 -1
  100. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +27 -20
  101. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
  102. package/dist/types/src/plugin-intent/intent.d.ts +3 -3
  103. package/dist/types/src/plugin-intent/intent.d.ts.map +1 -1
  104. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -1
  105. package/dist/types/src/plugin-settings/actions.d.ts +11 -1
  106. package/dist/types/src/plugin-settings/actions.d.ts.map +1 -1
  107. package/dist/types/src/plugin-settings/app-graph-builder.d.ts +197 -0
  108. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -0
  109. package/dist/types/src/plugin-settings/intent-resolver.d.ts +4 -0
  110. package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +1 -0
  111. package/dist/types/src/plugin-settings/store.d.ts +5 -0
  112. package/dist/types/src/plugin-settings/store.d.ts.map +1 -0
  113. package/dist/types/src/plugin-settings/translations.d.ts +11 -0
  114. package/dist/types/src/plugin-settings/translations.d.ts.map +1 -0
  115. package/dist/types/src/{plugin-intent → react}/IntentContext.d.ts +1 -1
  116. package/dist/types/src/react/IntentContext.d.ts.map +1 -0
  117. package/dist/types/src/react/Surface.d.ts.map +1 -1
  118. package/dist/types/src/react/Surface.stories.d.ts +16 -0
  119. package/dist/types/src/react/Surface.stories.d.ts.map +1 -0
  120. package/dist/types/src/react/common.d.ts +12 -0
  121. package/dist/types/src/react/common.d.ts.map +1 -0
  122. package/dist/types/src/react/index.d.ts +2 -0
  123. package/dist/types/src/react/index.d.ts.map +1 -1
  124. package/dist/types/src/react/useIntentResolver.d.ts +3 -0
  125. package/dist/types/src/react/useIntentResolver.d.ts.map +1 -0
  126. package/dist/types/src/testing/withPluginManager.d.ts +1 -1
  127. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  128. package/dist/types/src/worker.d.ts +4 -0
  129. package/dist/types/src/worker.d.ts.map +1 -0
  130. package/package.json +26 -20
  131. package/project.json +3 -3
  132. package/src/App.tsx +15 -14
  133. package/src/common/capabilities.ts +20 -11
  134. package/src/common/events.ts +10 -1
  135. package/src/common/file.ts +1 -1
  136. package/src/common/graph.ts +2 -2
  137. package/src/common/index.ts +0 -1
  138. package/src/common/layout.ts +194 -126
  139. package/src/common/surface.ts +2 -2
  140. package/src/common/translations.ts +7 -8
  141. package/src/core/capabilities.ts +16 -7
  142. package/src/core/manager.test.ts +22 -73
  143. package/src/core/manager.ts +105 -91
  144. package/src/core/plugin.ts +6 -3
  145. package/src/playground/debug/plugin.ts +1 -1
  146. package/src/playground/generator/Toolbar.tsx +11 -11
  147. package/src/playground/generator/generator.ts +25 -0
  148. package/src/playground/generator/plugin.ts +6 -1
  149. package/src/playground/layout/plugin.ts +1 -1
  150. package/src/playground/logger/Toolbar.tsx +2 -1
  151. package/src/playground/logger/plugin.ts +6 -3
  152. package/src/playground/logger/schema.ts +1 -1
  153. package/src/plugin-intent/IntentPlugin.tsx +3 -43
  154. package/src/plugin-intent/actions.ts +1 -1
  155. package/src/plugin-intent/index.ts +0 -1
  156. package/src/plugin-intent/intent-dispatcher.test.ts +48 -29
  157. package/src/plugin-intent/intent-dispatcher.ts +76 -41
  158. package/src/plugin-intent/intent.ts +5 -5
  159. package/src/plugin-settings/SettingsPlugin.ts +19 -13
  160. package/src/plugin-settings/actions.ts +11 -1
  161. package/src/plugin-settings/app-graph-builder.ts +122 -0
  162. package/src/plugin-settings/intent-resolver.ts +28 -0
  163. package/src/plugin-settings/store.ts +20 -0
  164. package/src/plugin-settings/translations.ts +17 -0
  165. package/src/{plugin-intent → react}/IntentContext.tsx +2 -2
  166. package/src/react/Surface.stories.tsx +96 -0
  167. package/src/react/Surface.tsx +11 -8
  168. package/src/react/common.ts +12 -0
  169. package/src/react/index.ts +2 -0
  170. package/src/react/useIntentResolver.ts +22 -0
  171. package/src/testing/withPluginManager.tsx +11 -3
  172. package/src/worker.ts +11 -0
  173. package/tsconfig.json +3 -3
  174. package/dist/lib/browser/chunk-GNLU3GAU.mjs.map +0 -7
  175. package/dist/lib/node/chunk-FBA4BB3J.cjs +0 -1639
  176. package/dist/lib/node/chunk-FBA4BB3J.cjs.map +0 -7
  177. package/dist/lib/node-esm/chunk-KPMTPXQI.mjs.map +0 -7
  178. package/dist/types/src/common/navigation.d.ts +0 -241
  179. package/dist/types/src/common/navigation.d.ts.map +0 -1
  180. package/dist/types/src/plugin-intent/IntentContext.d.ts.map +0 -1
  181. package/src/common/navigation.ts +0 -199
@@ -1,199 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import { Schema as S } from '@effect/schema';
6
-
7
- import { pick } from '@dxos/util';
8
-
9
- // NOTE(thure): These are chosen from RFC 1738’s `safe` characters: http://www.faqs.org/rfcs/rfc1738.html
10
- export const SLUG_LIST_SEPARATOR = '+';
11
- export const SLUG_ENTRY_SEPARATOR = '_';
12
- export const SLUG_KEY_VALUE_SEPARATOR = '-';
13
- export const SLUG_PATH_SEPARATOR = '~';
14
- export const SLUG_COLLECTION_INDICATOR = '';
15
-
16
- const LayoutEntrySchema = S.mutable(S.Struct({ id: S.String, path: S.optional(S.String) }));
17
- export type LayoutEntry = S.Schema.Type<typeof LayoutEntrySchema>;
18
-
19
- // TODO(Zan): Consider renaming the 'main' part to 'deck' part now that we are throwing out the old layout plugin.
20
- // TODO(Zan): Extend to all strings?
21
- const LayoutPartSchema = S.Union(
22
- S.Literal('sidebar'),
23
- S.Literal('main'),
24
- S.Literal('solo'),
25
- S.Literal('complementary'),
26
- S.Literal('fullScreen'),
27
- );
28
- export type LayoutPart = S.Schema.Type<typeof LayoutPartSchema>;
29
-
30
- const LayoutPartsSchema = S.partial(
31
- S.mutable(S.Record({ key: LayoutPartSchema, value: S.mutable(S.Array(LayoutEntrySchema)) })),
32
- );
33
- export type LayoutParts = S.Schema.Type<typeof LayoutPartsSchema>;
34
-
35
- const LayoutCoordinateSchema = S.mutable(S.Struct({ part: LayoutPartSchema, entryId: S.String }));
36
- export type LayoutCoordinate = S.Schema.Type<typeof LayoutCoordinateSchema>;
37
-
38
- const PartAdjustmentSchema = S.Union(
39
- S.Literal('increment-start'),
40
- S.Literal('increment-end'),
41
- S.Literal('pin-start'),
42
- S.Literal('pin-end'),
43
- S.Literal('close'),
44
- S.Literal('solo'),
45
- );
46
- export type PartAdjustment = S.Schema.Type<typeof PartAdjustmentSchema>;
47
-
48
- const LayoutAdjustmentSchema = S.mutable(
49
- S.Struct({ layoutCoordinate: LayoutCoordinateSchema, type: PartAdjustmentSchema }),
50
- );
51
- export type LayoutAdjustment = S.Schema.Type<typeof LayoutAdjustmentSchema>;
52
-
53
- /** @deprecated */
54
- export const ActiveParts = S.Record({ key: S.String, value: S.Union(S.String, S.mutable(S.Array(S.String))) });
55
- export type ActiveParts = S.Schema.Type<typeof ActiveParts>;
56
-
57
- // TODO(burdon): Where should this go?
58
- export type LayoutContainerProps<T> = T & { role?: string; coordinate?: LayoutCoordinate };
59
-
60
- /**
61
- * Provides for a plugin that can manage the app navigation.
62
- */
63
- const LocationProvidesSchema = S.mutable(
64
- S.Struct({
65
- location: S.Struct({
66
- active: LayoutPartsSchema,
67
- closed: S.Array(S.String),
68
- }),
69
- }),
70
- );
71
- export type LocationProvides = S.Schema.Type<typeof LocationProvidesSchema>;
72
-
73
- /**
74
- * Type guard for layout plugins.
75
- */
76
- export const isLayoutParts = (value: unknown): value is LayoutParts => {
77
- return S.is(LayoutPartsSchema)(value);
78
- };
79
-
80
- // Type guard for PartAdjustment.
81
- export const isLayoutAdjustment = (value: unknown): value is LayoutAdjustment => {
82
- return S.is(LayoutAdjustmentSchema)(value);
83
- };
84
-
85
- /**
86
- * Utilities.
87
- */
88
-
89
- /** Extracts all unique IDs from the layout parts. */
90
- export const openIds = (layout: LayoutParts, parts?: LayoutPart[]): string[] => {
91
- return Object.values(parts ? pick(layout, parts) : layout)
92
- .flatMap((part) => part?.map((entry) => entry.id) ?? [])
93
- .filter((id): id is string => id !== undefined);
94
- };
95
-
96
- export const firstIdInPart = (layout: LayoutParts | undefined, part: LayoutPart): string | undefined => {
97
- if (!layout) {
98
- return undefined;
99
- }
100
-
101
- return layout[part]?.at(0)?.id;
102
- };
103
-
104
- export const indexInPart = (
105
- layout: LayoutParts | undefined,
106
- layoutCoordinate: LayoutCoordinate | undefined,
107
- ): number | undefined => {
108
- if (!layout || !layoutCoordinate) {
109
- return undefined;
110
- }
111
-
112
- const { part, entryId } = layoutCoordinate;
113
- return layout[part]?.findIndex((entry) => entry.id === entryId);
114
- };
115
-
116
- export const partLength = (layout: LayoutParts | undefined, part: LayoutPart | undefined): number => {
117
- if (!layout || !part) {
118
- return 0;
119
- }
120
-
121
- return layout[part]?.length ?? 0;
122
- };
123
-
124
- //
125
- // Intents
126
- //
127
-
128
- export const NAVIGATION_PLUGIN = 'dxos.org/plugin/navigation';
129
- export const NAVIGATION_ACTION = `${NAVIGATION_PLUGIN}/action`;
130
-
131
- /**
132
- * Expected payload for navigation actions.
133
- */
134
- // TODO(wittjosiah): These seem to be too deck-specific.
135
- export namespace NavigationAction {
136
- /**
137
- * An additive overlay to apply to `location.active` (i.e. the result is a union of previous active and the argument)
138
- */
139
- export class Open extends S.TaggedClass<Open>()(`${NAVIGATION_ACTION}/open`, {
140
- input: S.Struct({
141
- activeParts: ActiveParts,
142
- noToggle: S.optional(S.Boolean),
143
- }),
144
- output: S.Struct({
145
- open: S.Array(S.String),
146
- }),
147
- }) {}
148
-
149
- /**
150
- * Payload for adding an item to the active items.
151
- */
152
- export class AddToActive extends S.TaggedClass<AddToActive>()(`${NAVIGATION_ACTION}/add-to-active`, {
153
- input: S.Struct({
154
- id: S.String,
155
- part: LayoutPartSchema,
156
- scrollIntoView: S.optional(S.Boolean),
157
- pivotId: S.optional(S.String),
158
- positioning: S.optional(S.Literal('start', 'end')),
159
- }),
160
- output: S.Void,
161
- }) {}
162
-
163
- /**
164
- * The active parts to directly set, to be used when working with URLs or restoring a specific state.
165
- */
166
- export class Set extends S.TaggedClass<Set>()(`${NAVIGATION_ACTION}/set`, {
167
- input: S.Struct({
168
- activeParts: ActiveParts,
169
- }),
170
- output: S.Void,
171
- }) {}
172
-
173
- /**
174
- * A subtractive overlay to apply to `location.active` (i.e. the result is a subtraction from the previous active of the argument)
175
- */
176
- export class Close extends S.TaggedClass<Close>()(`${NAVIGATION_ACTION}/close`, {
177
- input: S.Struct({
178
- activeParts: ActiveParts,
179
- noToggle: S.optional(S.Boolean),
180
- }),
181
- output: S.Void,
182
- }) {}
183
-
184
- /**
185
- * An atomic transaction to apply to `location.active`, describing which element to (attempt to) move to which location.
186
- */
187
- export class Adjust extends S.TaggedClass<Adjust>()(`${NAVIGATION_ACTION}/adjust`, {
188
- input: LayoutAdjustmentSchema,
189
- output: S.Void,
190
- }) {}
191
-
192
- // TODO(wittjosiah): This action seems unrelated to the others.
193
- export class Expose extends S.TaggedClass<Expose>()(`${NAVIGATION_ACTION}/expose`, {
194
- input: S.Struct({
195
- id: S.String,
196
- }),
197
- output: S.Void,
198
- }) {}
199
- }