@dxos/app-framework 0.7.5-main.9d2a38b → 0.7.5-main.ff8607b
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/app-graph-builder-F7VZ6LRN.mjs +137 -0
- package/dist/lib/browser/app-graph-builder-F7VZ6LRN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-GNLU3GAU.mjs → chunk-ATRNTMSS.mjs} +623 -819
- package/dist/lib/browser/chunk-ATRNTMSS.mjs.map +7 -0
- package/dist/lib/browser/chunk-LDJ3T4V3.mjs +32 -0
- package/dist/lib/browser/chunk-LDJ3T4V3.mjs.map +7 -0
- package/dist/lib/browser/chunk-WS6SU6HI.mjs +285 -0
- package/dist/lib/browser/chunk-WS6SU6HI.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +57 -74
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-dispatcher-E6J7E5Y5.mjs +11 -0
- package/dist/lib/browser/intent-dispatcher-E6J7E5Y5.mjs.map +7 -0
- package/dist/lib/browser/intent-resolver-XLE4L3LS.mjs +38 -0
- package/dist/lib/browser/intent-resolver-XLE4L3LS.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/store-QU2IKFAI.mjs +19 -0
- package/dist/lib/browser/store-QU2IKFAI.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +10 -3
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/worker.mjs +77 -0
- package/dist/lib/browser/worker.mjs.map +7 -0
- package/dist/lib/node/app-graph-builder-JGBADFF7.cjs +146 -0
- package/dist/lib/node/app-graph-builder-JGBADFF7.cjs.map +7 -0
- package/dist/lib/node/chunk-QLVQ6PND.cjs +58 -0
- package/dist/lib/node/chunk-QLVQ6PND.cjs.map +7 -0
- package/dist/lib/node/chunk-WKC6YMEQ.cjs +1433 -0
- package/dist/lib/node/chunk-WKC6YMEQ.cjs.map +7 -0
- package/dist/lib/node/chunk-WRWRZKZU.cjs +308 -0
- package/dist/lib/node/chunk-WRWRZKZU.cjs.map +7 -0
- package/dist/lib/node/index.cjs +106 -118
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/intent-dispatcher-CFBKDZQR.cjs +32 -0
- package/dist/lib/node/intent-dispatcher-CFBKDZQR.cjs.map +7 -0
- package/dist/lib/node/intent-resolver-3TKCXP4S.cjs +45 -0
- package/dist/lib/node/intent-resolver-3TKCXP4S.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/store-4QMUUU2A.cjs +34 -0
- package/dist/lib/node/store-4QMUUU2A.cjs.map +7 -0
- package/dist/lib/node/testing/index.cjs +15 -8
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/lib/node/worker.cjs +99 -0
- package/dist/lib/node/worker.cjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-2QEX57NX.mjs +138 -0
- package/dist/lib/node-esm/app-graph-builder-2QEX57NX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-KPMTPXQI.mjs → chunk-44J2VZBB.mjs} +623 -819
- package/dist/lib/node-esm/chunk-44J2VZBB.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CNJYZNSL.mjs +34 -0
- package/dist/lib/node-esm/chunk-CNJYZNSL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HTLXL32I.mjs +286 -0
- package/dist/lib/node-esm/chunk-HTLXL32I.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +57 -74
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-dispatcher-LDQGDZ62.mjs +12 -0
- package/dist/lib/node-esm/intent-dispatcher-LDQGDZ62.mjs.map +7 -0
- package/dist/lib/node-esm/intent-resolver-7VJWN67U.mjs +39 -0
- package/dist/lib/node-esm/intent-resolver-7VJWN67U.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/store-VWDAYUQY.mjs +20 -0
- package/dist/lib/node-esm/store-VWDAYUQY.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +10 -3
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/worker.mjs +78 -0
- package/dist/lib/node-esm/worker.mjs.map +7 -0
- package/dist/types/src/App.d.ts.map +1 -1
- package/dist/types/src/common/capabilities.d.ts +63 -110
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/events.d.ts +8 -1
- package/dist/types/src/common/events.d.ts.map +1 -1
- package/dist/types/src/common/file.d.ts +1 -1
- package/dist/types/src/common/file.d.ts.map +1 -1
- package/dist/types/src/common/graph.d.ts +2 -2
- package/dist/types/src/common/graph.d.ts.map +1 -1
- package/dist/types/src/common/index.d.ts +0 -1
- package/dist/types/src/common/index.d.ts.map +1 -1
- package/dist/types/src/common/layout.d.ts +204 -121
- package/dist/types/src/common/layout.d.ts.map +1 -1
- package/dist/types/src/common/surface.d.ts +3 -3
- package/dist/types/src/common/surface.d.ts.map +1 -1
- package/dist/types/src/common/translations.d.ts +7 -7
- package/dist/types/src/common/translations.d.ts.map +1 -1
- package/dist/types/src/core/capabilities.d.ts +6 -2
- package/dist/types/src/core/capabilities.d.ts.map +1 -1
- package/dist/types/src/core/manager.d.ts +2 -9
- package/dist/types/src/core/manager.d.ts.map +1 -1
- package/dist/types/src/core/plugin.d.ts +5 -2
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -1
- package/dist/types/src/playground/generator/generator.d.ts +2 -0
- package/dist/types/src/playground/generator/generator.d.ts.map +1 -1
- package/dist/types/src/playground/generator/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/logger/Toolbar.d.ts.map +1 -1
- package/dist/types/src/playground/logger/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/logger/schema.d.ts +1 -1
- package/dist/types/src/playground/logger/schema.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/actions.d.ts +1 -1
- package/dist/types/src/plugin-intent/actions.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/index.d.ts +0 -1
- package/dist/types/src/plugin-intent/index.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +27 -20
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/intent.d.ts +3 -3
- package/dist/types/src/plugin-intent/intent.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/actions.d.ts +11 -1
- package/dist/types/src/plugin-settings/actions.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts +197 -0
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/intent-resolver.d.ts +4 -0
- package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/store.d.ts +5 -0
- package/dist/types/src/plugin-settings/store.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/translations.d.ts +11 -0
- package/dist/types/src/plugin-settings/translations.d.ts.map +1 -0
- package/dist/types/src/{plugin-intent → react}/IntentContext.d.ts +1 -1
- package/dist/types/src/react/IntentContext.d.ts.map +1 -0
- package/dist/types/src/react/Surface.d.ts.map +1 -1
- package/dist/types/src/react/Surface.stories.d.ts +16 -0
- package/dist/types/src/react/Surface.stories.d.ts.map +1 -0
- package/dist/types/src/react/common.d.ts +12 -0
- package/dist/types/src/react/common.d.ts.map +1 -0
- package/dist/types/src/react/index.d.ts +2 -0
- package/dist/types/src/react/index.d.ts.map +1 -1
- package/dist/types/src/react/useIntentResolver.d.ts +3 -0
- package/dist/types/src/react/useIntentResolver.d.ts.map +1 -0
- package/dist/types/src/testing/withPluginManager.d.ts +1 -1
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
- package/dist/types/src/worker.d.ts +4 -0
- package/dist/types/src/worker.d.ts.map +1 -0
- package/package.json +26 -20
- package/project.json +3 -3
- package/src/App.tsx +15 -14
- package/src/common/capabilities.ts +20 -11
- package/src/common/events.ts +10 -1
- package/src/common/file.ts +1 -1
- package/src/common/graph.ts +2 -2
- package/src/common/index.ts +0 -1
- package/src/common/layout.ts +194 -126
- package/src/common/surface.ts +2 -2
- package/src/common/translations.ts +7 -8
- package/src/core/capabilities.ts +16 -7
- package/src/core/manager.test.ts +22 -73
- package/src/core/manager.ts +105 -91
- package/src/core/plugin.ts +6 -3
- package/src/playground/debug/plugin.ts +1 -1
- package/src/playground/generator/Toolbar.tsx +11 -11
- package/src/playground/generator/generator.ts +25 -0
- package/src/playground/generator/plugin.ts +6 -1
- package/src/playground/layout/plugin.ts +1 -1
- package/src/playground/logger/Toolbar.tsx +2 -1
- package/src/playground/logger/plugin.ts +6 -3
- package/src/playground/logger/schema.ts +1 -1
- package/src/plugin-intent/IntentPlugin.tsx +3 -43
- package/src/plugin-intent/actions.ts +1 -1
- package/src/plugin-intent/index.ts +0 -1
- package/src/plugin-intent/intent-dispatcher.test.ts +48 -29
- package/src/plugin-intent/intent-dispatcher.ts +76 -41
- package/src/plugin-intent/intent.ts +5 -5
- package/src/plugin-settings/SettingsPlugin.ts +19 -13
- package/src/plugin-settings/actions.ts +11 -1
- package/src/plugin-settings/app-graph-builder.ts +122 -0
- package/src/plugin-settings/intent-resolver.ts +28 -0
- package/src/plugin-settings/store.ts +20 -0
- package/src/plugin-settings/translations.ts +17 -0
- package/src/{plugin-intent → react}/IntentContext.tsx +2 -2
- package/src/react/Surface.stories.tsx +96 -0
- package/src/react/Surface.tsx +11 -8
- package/src/react/common.ts +12 -0
- package/src/react/index.ts +2 -0
- package/src/react/useIntentResolver.ts +22 -0
- package/src/testing/withPluginManager.tsx +11 -3
- package/src/worker.ts +11 -0
- package/tsconfig.json +3 -3
- package/dist/lib/browser/chunk-GNLU3GAU.mjs.map +0 -7
- package/dist/lib/node/chunk-FBA4BB3J.cjs +0 -1639
- package/dist/lib/node/chunk-FBA4BB3J.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-KPMTPXQI.mjs.map +0 -7
- package/dist/types/src/common/navigation.d.ts +0 -241
- package/dist/types/src/common/navigation.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/IntentContext.d.ts.map +0 -1
- package/src/common/navigation.ts +0 -199
package/src/common/navigation.ts
DELETED
|
@@ -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
|
-
}
|