@dxos/plugin-deck 0.8.2-main.2f9c567 → 0.8.2-main.5885341
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{chunk-PGSJT5PG.mjs → chunk-6HJZL3WT.mjs} +2 -2
- package/dist/lib/browser/{chunk-RKYIMUKW.mjs → chunk-RBJ6DLAC.mjs} +8 -8
- package/dist/lib/browser/{chunk-AHTP72DY.mjs → chunk-RDFJGGGX.mjs} +3 -3
- package/dist/lib/browser/chunk-ZMJMCN7O.mjs +157 -0
- package/dist/lib/browser/chunk-ZMJMCN7O.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3 -3
- package/dist/lib/browser/{intent-resolver-NO6L67KF.mjs → intent-resolver-JKWXWUV6.mjs} +23 -23
- package/dist/lib/browser/intent-resolver-JKWXWUV6.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-5RWCIUXV.mjs → react-root-S6ZAKNZA.mjs} +5 -5
- package/dist/lib/browser/{react-surface-DIDOPTH7.mjs → react-surface-I7WZBOGM.mjs} +5 -5
- package/dist/lib/browser/{settings-C7LX2GXF.mjs → settings-6NU7CF2B.mjs} +2 -2
- package/dist/lib/browser/{state-AX74YEJD.mjs → state-Z6UY2Z3M.mjs} +2 -2
- package/dist/lib/browser/{tools-7W7KZRAX.mjs → tools-VDVQTJMD.mjs} +7 -7
- package/dist/lib/browser/tools-VDVQTJMD.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/browser/{url-handler-AF5SYROZ.mjs → url-handler-3CARFXQK.mjs} +2 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/tools.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +104 -104
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +28 -29
- package/src/capabilities/intent-resolver.ts +32 -32
- package/src/capabilities/tools.ts +3 -4
- package/src/types.ts +71 -72
- package/dist/lib/browser/chunk-E7TOEOGO.mjs +0 -157
- package/dist/lib/browser/chunk-E7TOEOGO.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-NO6L67KF.mjs.map +0 -7
- package/dist/lib/browser/tools-7W7KZRAX.mjs.map +0 -7
- /package/dist/lib/browser/{chunk-PGSJT5PG.mjs.map → chunk-6HJZL3WT.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-RKYIMUKW.mjs.map → chunk-RBJ6DLAC.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-AHTP72DY.mjs.map → chunk-RDFJGGGX.mjs.map} +0 -0
- /package/dist/lib/browser/{react-root-5RWCIUXV.mjs.map → react-root-S6ZAKNZA.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-DIDOPTH7.mjs.map → react-surface-I7WZBOGM.mjs.map} +0 -0
- /package/dist/lib/browser/{settings-C7LX2GXF.mjs.map → settings-6NU7CF2B.mjs.map} +0 -0
- /package/dist/lib/browser/{state-AX74YEJD.mjs.map → state-Z6UY2Z3M.mjs.map} +0 -0
- /package/dist/lib/browser/{url-handler-AF5SYROZ.mjs.map → url-handler-3CARFXQK.mjs.map} +0 -0
package/src/types.ts
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Schema } from 'effect';
|
|
6
|
-
|
|
7
5
|
import { LayoutAction } from '@dxos/app-framework';
|
|
6
|
+
import { S } from '@dxos/echo-schema';
|
|
8
7
|
import { type DeepReadonly } from '@dxos/util';
|
|
9
8
|
|
|
10
9
|
import { DECK_PLUGIN } from './meta';
|
|
@@ -24,33 +23,33 @@ export type Overscroll = (typeof OverscrollOptions)[number];
|
|
|
24
23
|
export type Part = 'solo' | 'deck' | 'complementary';
|
|
25
24
|
export type ResolvedPart = Part | 'solo-primary' | 'solo-companion';
|
|
26
25
|
|
|
27
|
-
export const DeckSettingsSchema =
|
|
28
|
-
showHints:
|
|
29
|
-
enableDeck:
|
|
30
|
-
enableNativeRedirect:
|
|
31
|
-
enableStatusbar:
|
|
32
|
-
newPlankPositioning:
|
|
33
|
-
overscroll:
|
|
34
|
-
}).pipe(
|
|
35
|
-
export type DeckSettingsProps =
|
|
26
|
+
export const DeckSettingsSchema = S.Struct({
|
|
27
|
+
showHints: S.optional(S.Boolean),
|
|
28
|
+
enableDeck: S.optional(S.Boolean),
|
|
29
|
+
enableNativeRedirect: S.optional(S.Boolean),
|
|
30
|
+
enableStatusbar: S.optional(S.Boolean),
|
|
31
|
+
newPlankPositioning: S.optional(S.Literal(...NewPlankPositions)),
|
|
32
|
+
overscroll: S.optional(S.Literal(...OverscrollOptions)),
|
|
33
|
+
}).pipe(S.mutable);
|
|
34
|
+
export type DeckSettingsProps = S.Schema.Type<typeof DeckSettingsSchema>;
|
|
36
35
|
|
|
37
|
-
export const PlankSizing =
|
|
38
|
-
export type PlankSizing =
|
|
36
|
+
export const PlankSizing = S.Record({ key: S.String, value: S.Number });
|
|
37
|
+
export type PlankSizing = S.Schema.Type<typeof PlankSizing>;
|
|
39
38
|
|
|
40
39
|
// State of an individual deck.
|
|
41
|
-
export const DeckState =
|
|
40
|
+
export const DeckState = S.Struct({
|
|
42
41
|
/** If false, the deck has not yet left solo mode and new planks should be soloed. */
|
|
43
|
-
initialized:
|
|
44
|
-
active:
|
|
42
|
+
initialized: S.Boolean,
|
|
43
|
+
active: S.mutable(S.Array(S.String)),
|
|
45
44
|
// TODO(wittjosiah): Piping into both mutable and optional caused invalid typescript output.
|
|
46
|
-
activeCompanions:
|
|
47
|
-
inactive:
|
|
48
|
-
solo:
|
|
49
|
-
fullscreen:
|
|
50
|
-
plankSizing:
|
|
51
|
-
companionFrameSizing:
|
|
45
|
+
activeCompanions: S.optional(S.mutable(S.Record({ key: S.String, value: S.String }))),
|
|
46
|
+
inactive: S.mutable(S.Array(S.String)),
|
|
47
|
+
solo: S.optional(S.String),
|
|
48
|
+
fullscreen: S.Boolean,
|
|
49
|
+
plankSizing: S.mutable(PlankSizing),
|
|
50
|
+
companionFrameSizing: S.mutable(PlankSizing),
|
|
52
51
|
});
|
|
53
|
-
export type DeckState =
|
|
52
|
+
export type DeckState = S.Schema.Type<typeof DeckState>;
|
|
54
53
|
|
|
55
54
|
export const defaultDeck: DeckState = {
|
|
56
55
|
initialized: false,
|
|
@@ -63,9 +62,9 @@ export const defaultDeck: DeckState = {
|
|
|
63
62
|
companionFrameSizing: {},
|
|
64
63
|
};
|
|
65
64
|
|
|
66
|
-
const LayoutMode =
|
|
67
|
-
export type LayoutMode =
|
|
68
|
-
export const isLayoutMode = (value: any): value is LayoutMode =>
|
|
65
|
+
const LayoutMode = S.Literal('deck', 'solo', 'solo--fullscreen');
|
|
66
|
+
export type LayoutMode = S.Schema.Type<typeof LayoutMode>;
|
|
67
|
+
export const isLayoutMode = (value: any): value is LayoutMode => S.is(LayoutMode)(value);
|
|
69
68
|
|
|
70
69
|
export const getMode = (deck: DeckState | DeepReadonly<DeckState>): LayoutMode => {
|
|
71
70
|
if (deck.solo) {
|
|
@@ -76,73 +75,73 @@ export const getMode = (deck: DeckState | DeepReadonly<DeckState>): LayoutMode =
|
|
|
76
75
|
};
|
|
77
76
|
|
|
78
77
|
// State of the deck plugin.
|
|
79
|
-
export const DeckPluginState =
|
|
80
|
-
sidebarState:
|
|
81
|
-
complementarySidebarState:
|
|
82
|
-
complementarySidebarPanel:
|
|
83
|
-
|
|
84
|
-
dialogOpen:
|
|
85
|
-
dialogBlockAlign:
|
|
86
|
-
dialogType:
|
|
78
|
+
export const DeckPluginState = S.Struct({
|
|
79
|
+
sidebarState: S.Literal('closed', 'collapsed', 'expanded'),
|
|
80
|
+
complementarySidebarState: S.Literal('closed', 'collapsed', 'expanded'),
|
|
81
|
+
complementarySidebarPanel: S.optional(S.String),
|
|
82
|
+
|
|
83
|
+
dialogOpen: S.Boolean,
|
|
84
|
+
dialogBlockAlign: S.optional(S.Literal('start', 'center', 'end')),
|
|
85
|
+
dialogType: S.optional(S.Literal('default', 'alert')),
|
|
87
86
|
/** Data to be passed to the dialog Surface. */
|
|
88
|
-
dialogContent:
|
|
87
|
+
dialogContent: S.optional(S.Any),
|
|
89
88
|
|
|
90
|
-
popoverOpen:
|
|
91
|
-
popoverSide:
|
|
92
|
-
popoverAnchor:
|
|
93
|
-
popoverAnchorId:
|
|
89
|
+
popoverOpen: S.Boolean,
|
|
90
|
+
popoverSide: S.optional(S.Literal('top', 'right', 'bottom', 'left')),
|
|
91
|
+
popoverAnchor: S.optional(S.Any),
|
|
92
|
+
popoverAnchorId: S.optional(S.String),
|
|
94
93
|
/** Data to be passed to the popover Surface. */
|
|
95
|
-
popoverContent:
|
|
94
|
+
popoverContent: S.optional(S.Any),
|
|
96
95
|
|
|
97
|
-
toasts:
|
|
98
|
-
currentUndoId:
|
|
96
|
+
toasts: S.mutable(S.Array(LayoutAction.Toast)),
|
|
97
|
+
currentUndoId: S.optional(S.String),
|
|
99
98
|
|
|
100
|
-
activeDeck:
|
|
101
|
-
previousDeck:
|
|
102
|
-
decks:
|
|
103
|
-
previousMode:
|
|
104
|
-
deck:
|
|
99
|
+
activeDeck: S.String,
|
|
100
|
+
previousDeck: S.String,
|
|
101
|
+
decks: S.mutable(S.Record({ key: S.String, value: S.mutable(DeckState) })),
|
|
102
|
+
previousMode: S.mutable(S.Record({ key: S.String, value: LayoutMode })),
|
|
103
|
+
deck: S.mutable(DeckState),
|
|
105
104
|
|
|
106
105
|
/** The identifier of a component to scroll into view when it is mounted. */
|
|
107
|
-
scrollIntoView:
|
|
108
|
-
}).pipe(
|
|
106
|
+
scrollIntoView: S.optional(S.String),
|
|
107
|
+
}).pipe(S.mutable);
|
|
109
108
|
|
|
110
|
-
export type DeckPluginState =
|
|
109
|
+
export type DeckPluginState = S.Schema.Type<typeof DeckPluginState>;
|
|
111
110
|
|
|
112
111
|
export const DECK_ACTION = `${DECK_PLUGIN}/action`;
|
|
113
112
|
|
|
114
113
|
export namespace DeckAction {
|
|
115
|
-
const PartAdjustmentSchema =
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
114
|
+
const PartAdjustmentSchema = S.Union(
|
|
115
|
+
S.Literal('close').annotations({ description: 'Close the plank.' }),
|
|
116
|
+
S.Literal('companion').annotations({ description: 'Open the companion plank.' }),
|
|
117
|
+
S.Literal('solo').annotations({ description: 'Solo the plank.' }),
|
|
118
|
+
S.Literal('solo--fullscreen').annotations({ description: 'Fullscreen the plank.' }),
|
|
119
|
+
S.Literal('increment-start').annotations({ description: 'Move the plank towards the start of the deck.' }),
|
|
120
|
+
S.Literal('increment-end').annotations({ description: 'Move the plank towards the end of the deck.' }),
|
|
122
121
|
);
|
|
123
|
-
export type PartAdjustment =
|
|
124
|
-
export const Adjustment =
|
|
125
|
-
export type Adjustment =
|
|
122
|
+
export type PartAdjustment = S.Schema.Type<typeof PartAdjustmentSchema>;
|
|
123
|
+
export const Adjustment = S.mutable(S.Struct({ id: S.String, type: PartAdjustmentSchema }));
|
|
124
|
+
export type Adjustment = S.Schema.Type<typeof Adjustment>;
|
|
126
125
|
|
|
127
126
|
// An atomic transaction to apply to the deck, describing which element to move to which location.
|
|
128
|
-
export class Adjust extends
|
|
127
|
+
export class Adjust extends S.TaggedClass<Adjust>()(`${DECK_ACTION}/adjust`, {
|
|
129
128
|
input: Adjustment,
|
|
130
|
-
output:
|
|
129
|
+
output: S.Void,
|
|
131
130
|
}) {}
|
|
132
131
|
|
|
133
|
-
export class UpdatePlankSize extends
|
|
134
|
-
input:
|
|
135
|
-
id:
|
|
136
|
-
size:
|
|
132
|
+
export class UpdatePlankSize extends S.TaggedClass<UpdatePlankSize>()(`${DECK_ACTION}/update-plank-size`, {
|
|
133
|
+
input: S.Struct({
|
|
134
|
+
id: S.String,
|
|
135
|
+
size: S.Number,
|
|
137
136
|
}),
|
|
138
|
-
output:
|
|
137
|
+
output: S.Void,
|
|
139
138
|
}) {}
|
|
140
139
|
|
|
141
|
-
export class ChangeCompanion extends
|
|
142
|
-
input:
|
|
143
|
-
primary:
|
|
144
|
-
companion:
|
|
140
|
+
export class ChangeCompanion extends S.TaggedClass<ChangeCompanion>()(`${DECK_ACTION}/change-companion`, {
|
|
141
|
+
input: S.Struct({
|
|
142
|
+
primary: S.String,
|
|
143
|
+
companion: S.Union(S.String, S.Null),
|
|
145
144
|
}),
|
|
146
|
-
output:
|
|
145
|
+
output: S.Void,
|
|
147
146
|
}) {}
|
|
148
147
|
}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DECK_PLUGIN
|
|
3
|
-
} from "./chunk-NSATFAEE.mjs";
|
|
4
|
-
|
|
5
|
-
// packages/plugins/plugin-deck/src/types.ts
|
|
6
|
-
import { Schema } from "effect";
|
|
7
|
-
import { LayoutAction } from "@dxos/app-framework";
|
|
8
|
-
import { ATTENDABLE_PATH_SEPARATOR } from "@dxos/react-ui-attention";
|
|
9
|
-
var PLANK_COMPANION_TYPE = "dxos.org/plugin/deck/plank-companion";
|
|
10
|
-
var DECK_COMPANION_TYPE = "dxos.org/plugin/deck/deck-companion";
|
|
11
|
-
var NewPlankPositions = [
|
|
12
|
-
"start",
|
|
13
|
-
"end"
|
|
14
|
-
];
|
|
15
|
-
var OverscrollOptions = [
|
|
16
|
-
"none",
|
|
17
|
-
"centering"
|
|
18
|
-
];
|
|
19
|
-
var DeckSettingsSchema = Schema.Struct({
|
|
20
|
-
showHints: Schema.optional(Schema.Boolean),
|
|
21
|
-
enableDeck: Schema.optional(Schema.Boolean),
|
|
22
|
-
enableNativeRedirect: Schema.optional(Schema.Boolean),
|
|
23
|
-
enableStatusbar: Schema.optional(Schema.Boolean),
|
|
24
|
-
newPlankPositioning: Schema.optional(Schema.Literal(...NewPlankPositions)),
|
|
25
|
-
overscroll: Schema.optional(Schema.Literal(...OverscrollOptions))
|
|
26
|
-
}).pipe(Schema.mutable);
|
|
27
|
-
var PlankSizing = Schema.Record({
|
|
28
|
-
key: Schema.String,
|
|
29
|
-
value: Schema.Number
|
|
30
|
-
});
|
|
31
|
-
var DeckState = Schema.Struct({
|
|
32
|
-
/** If false, the deck has not yet left solo mode and new planks should be soloed. */
|
|
33
|
-
initialized: Schema.Boolean,
|
|
34
|
-
active: Schema.mutable(Schema.Array(Schema.String)),
|
|
35
|
-
// TODO(wittjosiah): Piping into both mutable and optional caused invalid typescript output.
|
|
36
|
-
activeCompanions: Schema.optional(Schema.mutable(Schema.Record({
|
|
37
|
-
key: Schema.String,
|
|
38
|
-
value: Schema.String
|
|
39
|
-
}))),
|
|
40
|
-
inactive: Schema.mutable(Schema.Array(Schema.String)),
|
|
41
|
-
solo: Schema.optional(Schema.String),
|
|
42
|
-
fullscreen: Schema.Boolean,
|
|
43
|
-
plankSizing: Schema.mutable(PlankSizing),
|
|
44
|
-
companionFrameSizing: Schema.mutable(PlankSizing)
|
|
45
|
-
});
|
|
46
|
-
var defaultDeck = {
|
|
47
|
-
initialized: false,
|
|
48
|
-
active: [],
|
|
49
|
-
activeCompanions: {},
|
|
50
|
-
inactive: [],
|
|
51
|
-
solo: void 0,
|
|
52
|
-
fullscreen: false,
|
|
53
|
-
plankSizing: {},
|
|
54
|
-
companionFrameSizing: {}
|
|
55
|
-
};
|
|
56
|
-
var LayoutMode = Schema.Literal("deck", "solo", "solo--fullscreen");
|
|
57
|
-
var isLayoutMode = (value) => Schema.is(LayoutMode)(value);
|
|
58
|
-
var getMode = (deck) => {
|
|
59
|
-
if (deck.solo) {
|
|
60
|
-
return deck.fullscreen ? "solo--fullscreen" : "solo";
|
|
61
|
-
}
|
|
62
|
-
return "deck";
|
|
63
|
-
};
|
|
64
|
-
var DeckPluginState = Schema.Struct({
|
|
65
|
-
sidebarState: Schema.Literal("closed", "collapsed", "expanded"),
|
|
66
|
-
complementarySidebarState: Schema.Literal("closed", "collapsed", "expanded"),
|
|
67
|
-
complementarySidebarPanel: Schema.optional(Schema.String),
|
|
68
|
-
dialogOpen: Schema.Boolean,
|
|
69
|
-
dialogBlockAlign: Schema.optional(Schema.Literal("start", "center", "end")),
|
|
70
|
-
dialogType: Schema.optional(Schema.Literal("default", "alert")),
|
|
71
|
-
/** Data to be passed to the dialog Surface. */
|
|
72
|
-
dialogContent: Schema.optional(Schema.Any),
|
|
73
|
-
popoverOpen: Schema.Boolean,
|
|
74
|
-
popoverSide: Schema.optional(Schema.Literal("top", "right", "bottom", "left")),
|
|
75
|
-
popoverAnchor: Schema.optional(Schema.Any),
|
|
76
|
-
popoverAnchorId: Schema.optional(Schema.String),
|
|
77
|
-
/** Data to be passed to the popover Surface. */
|
|
78
|
-
popoverContent: Schema.optional(Schema.Any),
|
|
79
|
-
toasts: Schema.mutable(Schema.Array(LayoutAction.Toast)),
|
|
80
|
-
currentUndoId: Schema.optional(Schema.String),
|
|
81
|
-
activeDeck: Schema.String,
|
|
82
|
-
previousDeck: Schema.String,
|
|
83
|
-
decks: Schema.mutable(Schema.Record({
|
|
84
|
-
key: Schema.String,
|
|
85
|
-
value: Schema.mutable(DeckState)
|
|
86
|
-
})),
|
|
87
|
-
previousMode: Schema.mutable(Schema.Record({
|
|
88
|
-
key: Schema.String,
|
|
89
|
-
value: LayoutMode
|
|
90
|
-
})),
|
|
91
|
-
deck: Schema.mutable(DeckState),
|
|
92
|
-
/** The identifier of a component to scroll into view when it is mounted. */
|
|
93
|
-
scrollIntoView: Schema.optional(Schema.String)
|
|
94
|
-
}).pipe(Schema.mutable);
|
|
95
|
-
var DECK_ACTION = `${DECK_PLUGIN}/action`;
|
|
96
|
-
var DeckAction;
|
|
97
|
-
(function(DeckAction2) {
|
|
98
|
-
const PartAdjustmentSchema = Schema.Union(Schema.Literal("close").annotations({
|
|
99
|
-
description: "Close the plank."
|
|
100
|
-
}), Schema.Literal("companion").annotations({
|
|
101
|
-
description: "Open the companion plank."
|
|
102
|
-
}), Schema.Literal("solo").annotations({
|
|
103
|
-
description: "Solo the plank."
|
|
104
|
-
}), Schema.Literal("solo--fullscreen").annotations({
|
|
105
|
-
description: "Fullscreen the plank."
|
|
106
|
-
}), Schema.Literal("increment-start").annotations({
|
|
107
|
-
description: "Move the plank towards the start of the deck."
|
|
108
|
-
}), Schema.Literal("increment-end").annotations({
|
|
109
|
-
description: "Move the plank towards the end of the deck."
|
|
110
|
-
}));
|
|
111
|
-
DeckAction2.Adjustment = Schema.mutable(Schema.Struct({
|
|
112
|
-
id: Schema.String,
|
|
113
|
-
type: PartAdjustmentSchema
|
|
114
|
-
}));
|
|
115
|
-
class Adjust extends Schema.TaggedClass()(`${DECK_ACTION}/adjust`, {
|
|
116
|
-
input: DeckAction2.Adjustment,
|
|
117
|
-
output: Schema.Void
|
|
118
|
-
}) {
|
|
119
|
-
}
|
|
120
|
-
DeckAction2.Adjust = Adjust;
|
|
121
|
-
class UpdatePlankSize extends Schema.TaggedClass()(`${DECK_ACTION}/update-plank-size`, {
|
|
122
|
-
input: Schema.Struct({
|
|
123
|
-
id: Schema.String,
|
|
124
|
-
size: Schema.Number
|
|
125
|
-
}),
|
|
126
|
-
output: Schema.Void
|
|
127
|
-
}) {
|
|
128
|
-
}
|
|
129
|
-
DeckAction2.UpdatePlankSize = UpdatePlankSize;
|
|
130
|
-
class ChangeCompanion extends Schema.TaggedClass()(`${DECK_ACTION}/change-companion`, {
|
|
131
|
-
input: Schema.Struct({
|
|
132
|
-
primary: Schema.String,
|
|
133
|
-
companion: Schema.Union(Schema.String, Schema.Null)
|
|
134
|
-
}),
|
|
135
|
-
output: Schema.Void
|
|
136
|
-
}) {
|
|
137
|
-
}
|
|
138
|
-
DeckAction2.ChangeCompanion = ChangeCompanion;
|
|
139
|
-
})(DeckAction || (DeckAction = {}));
|
|
140
|
-
|
|
141
|
-
export {
|
|
142
|
-
PLANK_COMPANION_TYPE,
|
|
143
|
-
DECK_COMPANION_TYPE,
|
|
144
|
-
NewPlankPositions,
|
|
145
|
-
OverscrollOptions,
|
|
146
|
-
DeckSettingsSchema,
|
|
147
|
-
PlankSizing,
|
|
148
|
-
DeckState,
|
|
149
|
-
defaultDeck,
|
|
150
|
-
isLayoutMode,
|
|
151
|
-
getMode,
|
|
152
|
-
DeckPluginState,
|
|
153
|
-
DECK_ACTION,
|
|
154
|
-
DeckAction,
|
|
155
|
-
ATTENDABLE_PATH_SEPARATOR
|
|
156
|
-
};
|
|
157
|
-
//# sourceMappingURL=chunk-E7TOEOGO.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { LayoutAction } from '@dxos/app-framework';\nimport { type DeepReadonly } from '@dxos/util';\n\nimport { DECK_PLUGIN } from './meta';\n\nexport { ATTENDABLE_PATH_SEPARATOR } from '@dxos/react-ui-attention';\n\nexport const PLANK_COMPANION_TYPE = 'dxos.org/plugin/deck/plank-companion';\nexport const DECK_COMPANION_TYPE = 'dxos.org/plugin/deck/deck-companion';\n\n// TODO(Zan): In the future we should consider adding new planks adjacent to the attended plank.\nexport const NewPlankPositions = ['start', 'end'] as const;\nexport type NewPlankPositioning = (typeof NewPlankPositions)[number];\n\nexport const OverscrollOptions = ['none', 'centering'] as const;\nexport type Overscroll = (typeof OverscrollOptions)[number];\n\nexport type Part = 'solo' | 'deck' | 'complementary';\nexport type ResolvedPart = Part | 'solo-primary' | 'solo-companion';\n\nexport const DeckSettingsSchema = Schema.Struct({\n showHints: Schema.optional(Schema.Boolean),\n enableDeck: Schema.optional(Schema.Boolean),\n enableNativeRedirect: Schema.optional(Schema.Boolean),\n enableStatusbar: Schema.optional(Schema.Boolean),\n newPlankPositioning: Schema.optional(Schema.Literal(...NewPlankPositions)),\n overscroll: Schema.optional(Schema.Literal(...OverscrollOptions)),\n}).pipe(Schema.mutable);\nexport type DeckSettingsProps = Schema.Schema.Type<typeof DeckSettingsSchema>;\n\nexport const PlankSizing = Schema.Record({ key: Schema.String, value: Schema.Number });\nexport type PlankSizing = Schema.Schema.Type<typeof PlankSizing>;\n\n// State of an individual deck.\nexport const DeckState = Schema.Struct({\n /** If false, the deck has not yet left solo mode and new planks should be soloed. */\n initialized: Schema.Boolean,\n active: Schema.mutable(Schema.Array(Schema.String)),\n // TODO(wittjosiah): Piping into both mutable and optional caused invalid typescript output.\n activeCompanions: Schema.optional(Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.String }))),\n inactive: Schema.mutable(Schema.Array(Schema.String)),\n solo: Schema.optional(Schema.String),\n fullscreen: Schema.Boolean,\n plankSizing: Schema.mutable(PlankSizing),\n companionFrameSizing: Schema.mutable(PlankSizing),\n});\nexport type DeckState = Schema.Schema.Type<typeof DeckState>;\n\nexport const defaultDeck: DeckState = {\n initialized: false,\n active: [],\n activeCompanions: {},\n inactive: [],\n solo: undefined,\n fullscreen: false,\n plankSizing: {},\n companionFrameSizing: {},\n};\n\nconst LayoutMode = Schema.Literal('deck', 'solo', 'solo--fullscreen');\nexport type LayoutMode = Schema.Schema.Type<typeof LayoutMode>;\nexport const isLayoutMode = (value: any): value is LayoutMode => Schema.is(LayoutMode)(value);\n\nexport const getMode = (deck: DeckState | DeepReadonly<DeckState>): LayoutMode => {\n if (deck.solo) {\n return deck.fullscreen ? 'solo--fullscreen' : 'solo';\n }\n\n return 'deck';\n};\n\n// State of the deck plugin.\nexport const DeckPluginState = Schema.Struct({\n sidebarState: Schema.Literal('closed', 'collapsed', 'expanded'),\n complementarySidebarState: Schema.Literal('closed', 'collapsed', 'expanded'),\n complementarySidebarPanel: Schema.optional(Schema.String),\n\n dialogOpen: Schema.Boolean,\n dialogBlockAlign: Schema.optional(Schema.Literal('start', 'center', 'end')),\n dialogType: Schema.optional(Schema.Literal('default', 'alert')),\n /** Data to be passed to the dialog Surface. */\n dialogContent: Schema.optional(Schema.Any),\n\n popoverOpen: Schema.Boolean,\n popoverSide: Schema.optional(Schema.Literal('top', 'right', 'bottom', 'left')),\n popoverAnchor: Schema.optional(Schema.Any),\n popoverAnchorId: Schema.optional(Schema.String),\n /** Data to be passed to the popover Surface. */\n popoverContent: Schema.optional(Schema.Any),\n\n toasts: Schema.mutable(Schema.Array(LayoutAction.Toast)),\n currentUndoId: Schema.optional(Schema.String),\n\n activeDeck: Schema.String,\n previousDeck: Schema.String,\n decks: Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.mutable(DeckState) })),\n previousMode: Schema.mutable(Schema.Record({ key: Schema.String, value: LayoutMode })),\n deck: Schema.mutable(DeckState),\n\n /** The identifier of a component to scroll into view when it is mounted. */\n scrollIntoView: Schema.optional(Schema.String),\n}).pipe(Schema.mutable);\n\nexport type DeckPluginState = Schema.Schema.Type<typeof DeckPluginState>;\n\nexport const DECK_ACTION = `${DECK_PLUGIN}/action`;\n\nexport namespace DeckAction {\n const PartAdjustmentSchema = Schema.Union(\n Schema.Literal('close').annotations({ description: 'Close the plank.' }),\n Schema.Literal('companion').annotations({ description: 'Open the companion plank.' }),\n Schema.Literal('solo').annotations({ description: 'Solo the plank.' }),\n Schema.Literal('solo--fullscreen').annotations({ description: 'Fullscreen the plank.' }),\n Schema.Literal('increment-start').annotations({ description: 'Move the plank towards the start of the deck.' }),\n Schema.Literal('increment-end').annotations({ description: 'Move the plank towards the end of the deck.' }),\n );\n export type PartAdjustment = Schema.Schema.Type<typeof PartAdjustmentSchema>;\n export const Adjustment = Schema.mutable(Schema.Struct({ id: Schema.String, type: PartAdjustmentSchema }));\n export type Adjustment = Schema.Schema.Type<typeof Adjustment>;\n\n // An atomic transaction to apply to the deck, describing which element to move to which location.\n export class Adjust extends Schema.TaggedClass<Adjust>()(`${DECK_ACTION}/adjust`, {\n input: Adjustment,\n output: Schema.Void,\n }) {}\n\n export class UpdatePlankSize extends Schema.TaggedClass<UpdatePlankSize>()(`${DECK_ACTION}/update-plank-size`, {\n input: Schema.Struct({\n id: Schema.String,\n size: Schema.Number,\n }),\n output: Schema.Void,\n }) {}\n\n export class ChangeCompanion extends Schema.TaggedClass<ChangeCompanion>()(`${DECK_ACTION}/change-companion`, {\n input: Schema.Struct({\n primary: Schema.String,\n companion: Schema.Union(Schema.String, Schema.Null),\n }),\n output: Schema.Void,\n }) {}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,cAAc;AAEvB,SAASC,oBAAoB;AAK7B,SAASC,iCAAiC;AAEnC,IAAMC,uBAAuB;AAC7B,IAAMC,sBAAsB;AAG5B,IAAMC,oBAAoB;EAAC;EAAS;;AAGpC,IAAMC,oBAAoB;EAAC;EAAQ;;AAMnC,IAAMC,qBAAqBC,OAAOC,OAAO;EAC9CC,WAAWF,OAAOG,SAASH,OAAOI,OAAO;EACzCC,YAAYL,OAAOG,SAASH,OAAOI,OAAO;EAC1CE,sBAAsBN,OAAOG,SAASH,OAAOI,OAAO;EACpDG,iBAAiBP,OAAOG,SAASH,OAAOI,OAAO;EAC/CI,qBAAqBR,OAAOG,SAASH,OAAOS,QAAO,GAAIZ,iBAAAA,CAAAA;EACvDa,YAAYV,OAAOG,SAASH,OAAOS,QAAO,GAAIX,iBAAAA,CAAAA;AAChD,CAAA,EAAGa,KAAKX,OAAOY,OAAO;AAGf,IAAMC,cAAcb,OAAOc,OAAO;EAAEC,KAAKf,OAAOgB;EAAQC,OAAOjB,OAAOkB;AAAO,CAAA;AAI7E,IAAMC,YAAYnB,OAAOC,OAAO;;EAErCmB,aAAapB,OAAOI;EACpBiB,QAAQrB,OAAOY,QAAQZ,OAAOsB,MAAMtB,OAAOgB,MAAM,CAAA;;EAEjDO,kBAAkBvB,OAAOG,SAASH,OAAOY,QAAQZ,OAAOc,OAAO;IAAEC,KAAKf,OAAOgB;IAAQC,OAAOjB,OAAOgB;EAAO,CAAA,CAAA,CAAA;EAC1GQ,UAAUxB,OAAOY,QAAQZ,OAAOsB,MAAMtB,OAAOgB,MAAM,CAAA;EACnDS,MAAMzB,OAAOG,SAASH,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wBAAwB1E,OAAOsE,YAAW,EAAoB,GAAGX,WAAAA,sBAAiC;IAC7GY,OAAOvE,OAAOC,OAAO;MACnBkE,IAAInE,OAAOgB;MACX2D,MAAM3E,OAAOkB;IACf,CAAA;IACAsD,QAAQxE,OAAOyE;EACjB,CAAA,EAAA;EAAI;cANSC,kBAAAA;EAQN,MAAME,wBAAwB5E,OAAOsE,YAAW,EAAoB,GAAGX,WAAAA,qBAAgC;IAC5GY,OAAOvE,OAAOC,OAAO;MACnB4E,SAAS7E,OAAOgB;MAChB8D,WAAW9E,OAAO+D,MAAM/D,OAAOgB,QAAQhB,OAAO+E,IAAI;IACpD,CAAA;IACAP,QAAQxE,OAAOyE;EACjB,CAAA,EAAA;EAAI;cANSG,kBAAAA;AAOf,GAlCiBf,eAAAA,aAAAA,CAAAA,EAAAA;",
|
|
6
|
-
"names": ["Schema", "LayoutAction", "ATTENDABLE_PATH_SEPARATOR", "PLANK_COMPANION_TYPE", "DECK_COMPANION_TYPE", "NewPlankPositions", "OverscrollOptions", "DeckSettingsSchema", "Schema", "Struct", "showHints", "optional", "Boolean", "enableDeck", "enableNativeRedirect", "enableStatusbar", "newPlankPositioning", "Literal", "overscroll", "pipe", "mutable", "PlankSizing", "Record", "key", "String", "value", "Number", "DeckState", "initialized", "active", "Array", "activeCompanions", "inactive", "solo", "fullscreen", "plankSizing", "companionFrameSizing", "defaultDeck", "undefined", "LayoutMode", "isLayoutMode", "is", "getMode", "deck", "DeckPluginState", "sidebarState", "complementarySidebarState", "complementarySidebarPanel", "dialogOpen", "dialogBlockAlign", "dialogType", "dialogContent", "Any", "popoverOpen", "popoverSide", "popoverAnchor", "popoverAnchorId", "popoverContent", "toasts", "LayoutAction", "Toast", "currentUndoId", "activeDeck", "previousDeck", "decks", "previousMode", "scrollIntoView", "DECK_ACTION", "DECK_PLUGIN", "DeckAction", "PartAdjustmentSchema", "Union", "annotations", "description", "Adjustment", "id", "type", "Adjust", "TaggedClass", "input", "output", "Void", "UpdatePlankSize", "size", "ChangeCompanion", "primary", "companion", "Null"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/intent-resolver.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { batch } from '@preact/signals-core';\nimport { Schema, Effect, pipe } from 'effect';\n\nimport {\n Capabilities,\n createResolver,\n contributes,\n IntentAction,\n LayoutAction,\n type PluginsContext,\n createIntent,\n chain,\n} from '@dxos/app-framework';\nimport { getTypename } from '@dxos/echo-schema';\nimport { invariant } from '@dxos/invariant';\nimport { isLiveObject } from '@dxos/live-object';\nimport { log } from '@dxos/log';\nimport { AttentionCapabilities } from '@dxos/plugin-attention';\nimport { type Node } from '@dxos/plugin-graph';\nimport { ObservabilityAction } from '@dxos/plugin-observability/types';\nimport { byPosition, isNonNullable } from '@dxos/util';\n\nimport { DeckCapabilities } from './capabilities';\nimport { closeEntry, createEntryId, incrementPlank, openEntry } from '../layout';\nimport { DECK_PLUGIN } from '../meta';\nimport {\n DeckAction,\n type LayoutMode,\n type DeckSettingsProps,\n isLayoutMode,\n getMode,\n defaultDeck,\n PLANK_COMPANION_TYPE,\n} from '../types';\nimport { setActive } from '../util';\n\nexport default (context: PluginsContext) =>\n contributes(Capabilities.IntentResolver, [\n createResolver({\n intent: IntentAction.ShowUndo,\n resolve: (data) => {\n const layout = context.requestCapability(DeckCapabilities.MutableDeckState);\n const { undoPromise: undo } = context.requestCapability(Capabilities.IntentDispatcher);\n\n // TODO(wittjosiah): Support undoing further back than the last action.\n if (layout.currentUndoId) {\n layout.toasts = layout.toasts.filter((toast) => toast.id !== layout.currentUndoId);\n }\n layout.currentUndoId = `${IntentAction.ShowUndo._tag}-${Date.now()}`;\n layout.toasts = [\n ...layout.toasts,\n {\n id: layout.currentUndoId,\n title: data.message ?? ['undo available label', { ns: DECK_PLUGIN }],\n duration: 10_000,\n actionLabel: ['undo action label', { ns: DECK_PLUGIN }],\n actionAlt: ['undo action alt', { ns: DECK_PLUGIN }],\n closeLabel: ['undo close label', { ns: DECK_PLUGIN }],\n onAction: () => undo(),\n },\n ];\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n // TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.UpdateSidebar.fields.input)`\n // but the filter is not being applied correctly.\n filter: (data): data is Schema.Schema.Type<typeof LayoutAction.UpdateSidebar.fields.input> =>\n Schema.is(LayoutAction.UpdateSidebar.fields.input)(data),\n resolve: ({ options }) => {\n const layout = context.requestCapability(DeckCapabilities.MutableDeckState);\n const next = options?.state ?? layout.sidebarState;\n if (next !== layout.sidebarState) {\n layout.sidebarState = next;\n }\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n // TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.UpdateComplementary.fields.input)`\n // but the filter is not being applied correctly.\n filter: (data): data is Schema.Schema.Type<typeof LayoutAction.UpdateComplementary.fields.input> =>\n Schema.is(LayoutAction.UpdateComplementary.fields.input)(data),\n resolve: ({ subject, options }) => {\n const layout = context.requestCapability(DeckCapabilities.MutableDeckState);\n\n if (layout.complementarySidebarPanel !== subject) {\n layout.complementarySidebarPanel = subject;\n }\n\n const next = subject ? 'expanded' : options?.state ?? layout.complementarySidebarState;\n if (next !== layout.complementarySidebarState) {\n layout.complementarySidebarState = next;\n }\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n // TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.UpdateDialog.fields.input)`\n // but the filter is not being applied correctly.\n filter: (data): data is Schema.Schema.Type<typeof LayoutAction.UpdateDialog.fields.input> =>\n Schema.is(LayoutAction.UpdateDialog.fields.input)(data),\n resolve: ({ subject, options }) => {\n const layout = context.requestCapability(DeckCapabilities.MutableDeckState);\n layout.dialogOpen = options.state ?? Boolean(subject);\n layout.dialogContent = subject ? { component: subject, props: options.props } : null;\n layout.dialogBlockAlign = options.blockAlign ?? 'center';\n layout.dialogType = options.type ?? 'default';\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n // TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.UpdatePopover.fields.input)`\n // but the filter is not being applied correctly.\n filter: (data): data is Schema.Schema.Type<typeof LayoutAction.UpdatePopover.fields.input> =>\n Schema.is(LayoutAction.UpdatePopover.fields.input)(data),\n resolve: ({ subject, options }) => {\n const layout = context.requestCapability(DeckCapabilities.MutableDeckState);\n layout.popoverOpen = options.state ?? Boolean(subject);\n layout.popoverContent =\n typeof subject === 'string' ? { component: subject, props: options.props } : subject ? { subject } : null;\n layout.popoverSide = options.side;\n if (options.variant === 'virtual') {\n layout.popoverAnchor = options.anchor;\n } else {\n layout.popoverAnchorId = options.anchorId;\n }\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n // TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.AddToast.fields.input)`\n // but the filter is not being applied correctly.\n filter: (data): data is Schema.Schema.Type<typeof LayoutAction.AddToast.fields.input> =>\n Schema.is(LayoutAction.AddToast.fields.input)(data),\n resolve: ({ subject }) => {\n const layout = context.requestCapability(DeckCapabilities.MutableDeckState);\n layout.toasts.push(subject);\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n // TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.SetLayoutMode.fields.input)`\n // but the filter is not being applied correctly.\n filter: (data): data is Schema.Schema.Type<typeof LayoutAction.SetLayoutMode.fields.input> => {\n if (!Schema.is(LayoutAction.SetLayoutMode.fields.input)(data)) {\n return false;\n }\n\n if ('mode' in data.options) {\n return isLayoutMode(data.options.mode);\n }\n\n return true;\n },\n resolve: ({ subject, options }) => {\n const state = context.requestCapability(DeckCapabilities.MutableDeckState);\n\n const setMode = (mode: LayoutMode) => {\n const deck = state.deck;\n const current = deck.solo ? [deck.solo] : deck.active;\n // When un-soloing, the solo entry is added to the deck.\n const next = (\n mode !== 'deck' ? [subject ?? deck.solo ?? deck.active[0]] : [...deck.active, deck.solo]\n ).filter(isNonNullable);\n\n const removed = current.filter((id) => !next.includes(id));\n const closed = Array.from(new Set([...deck.inactive.filter((id) => !next.includes(id)), ...removed]));\n deck.inactive = closed;\n\n if (mode !== 'deck' && next[0]) {\n deck.solo = next[0];\n } else if (mode === 'deck' && deck.solo) {\n deck.solo = undefined;\n deck.initialized = true;\n }\n\n if (mode === 'solo--fullscreen') {\n deck.fullscreen = !deck.fullscreen;\n }\n };\n\n return batch(() => {\n if ('mode' in options) {\n const current = getMode(state.deck);\n if (current !== options.mode) {\n state.previousMode[state.activeDeck] = current;\n }\n setMode(options.mode as LayoutMode);\n } else if ('revert' in options) {\n const last = state.previousMode[state.activeDeck];\n setMode(last ?? 'solo');\n } else {\n log.warn('Invalid layout mode', options);\n }\n });\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n filter: (data): data is Schema.Schema.Type<typeof LayoutAction.SwitchWorkspace.fields.input> =>\n Schema.is(LayoutAction.SwitchWorkspace.fields.input)(data),\n resolve: ({ subject }) => {\n const state = context.requestCapability(DeckCapabilities.MutableDeckState);\n batch(() => {\n // TODO(wittjosiah): This is a hack to prevent the previous deck from being set for pinned items.\n // Ideally this should be worked into the data model in a generic way.\n if (!state.activeDeck.startsWith('!')) {\n state.previousDeck = state.activeDeck;\n }\n state.activeDeck = subject;\n if (!state.decks[subject]) {\n state.decks[subject] = { ...defaultDeck };\n }\n });\n\n const first = state.deck.solo ? state.deck.solo : state.deck.active[0];\n if (first) {\n return {\n intents: [createIntent(LayoutAction.ScrollIntoView, { part: 'current', subject: first })],\n };\n }\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n filter: (data): data is Schema.Schema.Type<typeof LayoutAction.RevertWorkspace.fields.input> =>\n Schema.is(LayoutAction.RevertWorkspace.fields.input)(data),\n resolve: () => {\n const state = context.requestCapability(DeckCapabilities.MutableDeckState);\n return {\n intents: [createIntent(LayoutAction.SwitchWorkspace, { part: 'workspace', subject: state.previousDeck })],\n };\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n filter: (data): data is Schema.Schema.Type<typeof LayoutAction.Open.fields.input> =>\n Schema.is(LayoutAction.Open.fields.input)(data),\n resolve: ({ subject, options }) =>\n Effect.gen(function* () {\n const { graph } = context.requestCapability(Capabilities.AppGraph);\n const state = context.requestCapability(DeckCapabilities.MutableDeckState);\n const attention = context.requestCapability(AttentionCapabilities.Attention);\n const settings = context\n .requestCapabilities(Capabilities.SettingsStore)[0]\n ?.getStore<DeckSettingsProps>(DECK_PLUGIN)?.value;\n\n if (options?.workspace && state.activeDeck !== options?.workspace) {\n const { dispatch } = context.requestCapability(Capabilities.IntentDispatcher);\n yield* dispatch(\n createIntent(LayoutAction.SwitchWorkspace, { part: 'workspace', subject: options.workspace }),\n );\n }\n\n const previouslyOpenIds = new Set<string>(state.deck.solo ? [state.deck.solo] : state.deck.active);\n batch(() => {\n const next = state.deck.solo\n ? (subject as string[]).map((id) => createEntryId(id, options?.variant))\n : subject.reduce(\n (acc, entryId) =>\n openEntry(acc, entryId, {\n key: options?.key,\n positioning: options?.positioning ?? settings?.newPlankPositioning,\n pivotId: options?.pivotId,\n variant: options?.variant,\n }),\n state.deck.active,\n );\n\n return setActive({ next, state, attention });\n });\n\n const ids = state.deck.solo ? [state.deck.solo] : state.deck.active;\n const newlyOpen = ids.filter((i) => !previouslyOpenIds.has(i));\n\n return {\n intents: [\n ...(options?.scrollIntoView !== false\n ? [createIntent(LayoutAction.ScrollIntoView, { part: 'current', subject: newlyOpen[0] ?? subject[0] })]\n : []),\n createIntent(LayoutAction.Expose, { part: 'navigation', subject: newlyOpen[0] ?? subject[0] }),\n ...newlyOpen.map((subjectId) => {\n const active = graph?.findNode(subjectId)?.data;\n const typename = isLiveObject(active) ? getTypename(active) : undefined;\n return createIntent(ObservabilityAction.SendEvent, {\n name: 'navigation.activate',\n properties: {\n subjectId,\n typename,\n },\n });\n }),\n ],\n };\n }),\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n filter: (data): data is Schema.Schema.Type<typeof LayoutAction.Close.fields.input> =>\n Schema.is(LayoutAction.Close.fields.input)(data),\n resolve: ({ subject }) => {\n const state = context.requestCapability(DeckCapabilities.MutableDeckState);\n const attention = context.requestCapability(AttentionCapabilities.Attention);\n const active = state.deck.solo ? [state.deck.solo] : state.deck.active;\n const next = subject.reduce((acc, id) => closeEntry(acc, id), active);\n const toAttend = setActive({ next, state, attention });\n\n const clearCompanionIntents = subject\n .filter((id) => state.deck.activeCompanions && id in state.deck.activeCompanions)\n .map((primary) => createIntent(DeckAction.ChangeCompanion, { primary, companion: null }));\n\n return {\n intents: [\n ...clearCompanionIntents,\n ...(toAttend ? [createIntent(LayoutAction.ScrollIntoView, { part: 'current', subject: toAttend })] : []),\n ],\n };\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n filter: (data): data is Schema.Schema.Type<typeof LayoutAction.Set.fields.input> =>\n Schema.is(LayoutAction.Set.fields.input)(data),\n resolve: ({ subject }) => {\n const state = context.requestCapability(DeckCapabilities.MutableDeckState);\n const attention = context.requestCapability(AttentionCapabilities.Attention);\n const toAttend = setActive({ next: subject as string[], state, attention });\n return {\n intents: toAttend ? [createIntent(LayoutAction.ScrollIntoView, { part: 'current', subject: toAttend })] : [],\n };\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n filter: (data): data is Schema.Schema.Type<typeof LayoutAction.ScrollIntoView.fields.input> =>\n Schema.is(LayoutAction.ScrollIntoView.fields.input)(data),\n resolve: ({ subject }) => {\n const layout = context.requestCapability(DeckCapabilities.MutableDeckState);\n layout.scrollIntoView = subject;\n },\n }),\n createResolver({\n intent: DeckAction.UpdatePlankSize,\n resolve: (data) => {\n const state = context.requestCapability(DeckCapabilities.MutableDeckState);\n state.deck.plankSizing[data.id] = data.size;\n },\n }),\n createResolver({\n intent: DeckAction.ChangeCompanion,\n resolve: (data) => {\n const state = context.requestCapability(DeckCapabilities.MutableDeckState);\n // TODO(thure): Reactivity only works when creating a lexically new `activeCompanions`… Are these not proxy objects?\n if (data.companion === null) {\n const { [data.primary]: _, ...nextActiveCompanions } = state.deck.activeCompanions ?? {};\n state.deck.activeCompanions = nextActiveCompanions;\n } else {\n invariant(data.companion !== data.primary);\n state.deck.activeCompanions = {\n ...state.deck.activeCompanions,\n [data.primary]: data.companion,\n };\n }\n },\n }),\n createResolver({\n intent: DeckAction.Adjust,\n resolve: (adjustment) => {\n const state = context.requestCapability(DeckCapabilities.MutableDeckState);\n const attention = context.requestCapability(AttentionCapabilities.Attention);\n const { graph } = context.requestCapability(Capabilities.AppGraph);\n\n return batch(() => {\n if (adjustment.type === 'increment-end' || adjustment.type === 'increment-start') {\n setActive({\n next: incrementPlank(state.deck.active, adjustment),\n state,\n attention,\n });\n }\n\n if (adjustment.type === 'companion') {\n const node = graph.findNode(adjustment.id);\n const [companion] = node\n ? graph\n .nodes(node, { filter: (n): n is Node<any> => n.type === PLANK_COMPANION_TYPE })\n .toSorted((a, b) => byPosition(a.properties, b.properties))\n : [];\n if (companion) {\n return {\n intents: [\n // TODO(wittjosiah): This should remember the previously selected companion.\n createIntent(DeckAction.ChangeCompanion, { primary: adjustment.id, companion: companion.id }),\n ],\n };\n }\n }\n\n if (adjustment.type.startsWith('solo')) {\n const entryId = adjustment.id;\n if (!state.deck.solo) {\n // Solo the entry.\n return {\n intents: [\n createIntent(LayoutAction.SetLayoutMode, {\n part: 'mode',\n subject: entryId,\n options: { mode: adjustment.type },\n }),\n ],\n };\n } else {\n if (adjustment.type === 'solo--fullscreen') {\n // Toggle fullscreen on the current entry.\n return {\n intents: [\n createIntent(LayoutAction.SetLayoutMode, {\n part: 'mode',\n subject: entryId,\n options: { mode: 'solo--fullscreen' },\n }),\n ],\n };\n } else if (adjustment.type === 'solo') {\n // Un-solo the current entry.\n return {\n intents: [\n // NOTE: The order of these is important.\n pipe(\n createIntent(LayoutAction.SetLayoutMode, { part: 'mode', options: { mode: 'deck' } }),\n chain(LayoutAction.Open, { part: 'main', subject: [entryId] }),\n ),\n ],\n };\n }\n }\n }\n });\n },\n }),\n ]);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAASA,aAAa;AACtB,SAASC,QAAQC,QAAQC,YAAY;AAErC,SACEC,cACAC,gBACAC,aACAC,cACAC,cAEAC,cACAC,aACK;AACP,SAASC,mBAAmB;AAC5B,SAASC,iBAAiB;AAC1B,SAASC,oBAAoB;AAC7B,SAASC,WAAW;AACpB,SAASC,6BAA6B;AAEtC,SAASC,2BAA2B;AACpC,SAASC,YAAYC,qBAAqB;;AAgB1C,IAAA,0BAAe,CAACC,YACdC,YAAYC,aAAaC,gBAAgB;EACvCC,eAAe;IACbC,QAAQC,aAAaC;IACrBC,SAAS,CAACC,SAAAA;AACR,YAAMC,SAASV,QAAQW,kBAAkBC,iBAAiBC,gBAAgB;AAC1E,YAAM,EAAEC,aAAaC,KAAI,IAAKf,QAAQW,kBAAkBT,aAAac,gBAAgB;AAGrF,UAAIN,OAAOO,eAAe;AACxBP,eAAOQ,SAASR,OAAOQ,OAAOC,OAAO,CAACC,UAAUA,MAAMC,OAAOX,OAAOO,aAAa;MACnF;AACAP,aAAOO,gBAAgB,GAAGX,aAAaC,SAASe,IAAI,IAAIC,KAAKC,IAAG,CAAA;AAChEd,aAAOQ,SAAS;WACXR,OAAOQ;QACV;UACEG,IAAIX,OAAOO;UACXQ,OAAOhB,KAAKiB,WAAW;YAAC;YAAwB;cAAEC,IAAIC;YAAY;;UAClEC,UAAU;UACVC,aAAa;YAAC;YAAqB;cAAEH,IAAIC;YAAY;;UACrDG,WAAW;YAAC;YAAmB;cAAEJ,IAAIC;YAAY;;UACjDI,YAAY;YAAC;YAAoB;cAAEL,IAAIC;YAAY;;UACnDK,UAAU,MAAMlB,KAAAA;QAClB;;IAEJ;EACF,CAAA;EACAX,eAAe;IACbC,QAAQ6B,aAAaC;;;IAGrBhB,QA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SAAS;;gBAEPC,aAAaoD,WAAWC,iBAAiB;kBAAEF,SAASW,WAAWjJ;kBAAIyI,WAAWA,UAAUzI;gBAAG,CAAA;;YAE/F;UACF;QACF;AAEA,YAAIiJ,WAAW5G,KAAKwC,WAAW,MAAA,GAAS;AACtC,gBAAM8B,UAAUsC,WAAWjJ;AAC3B,cAAI,CAACsB,MAAMgC,KAAKE,MAAM;AAEpB,mBAAO;cACL0B,SAAS;gBACPC,aAAatE,aAAaqC,eAAe;kBACvCmC,MAAM;kBACN5D,SAASkF;kBACTvF,SAAS;oBAAEgC,MAAM6F,WAAW5G;kBAAK;gBACnC,CAAA;;YAEJ;UACF,OAAO;AACL,gBAAI4G,WAAW5G,SAAS,oBAAoB;AAE1C,qBAAO;gBACL6C,SAAS;kBACPC,aAAatE,aAAaqC,eAAe;oBACvCmC,MAAM;oBACN5D,SAASkF;oBACTvF,SAAS;sBAAEgC,MAAM;oBAAmB;kBACtC,CAAA;;cAEJ;YACF,WAAW6F,WAAW5G,SAAS,QAAQ;AAErC,qBAAO;gBACL6C,SAAS;;kBAEPyE,KACExE,aAAatE,aAAaqC,eAAe;oBAAEmC,MAAM;oBAAQjE,SAAS;sBAAEgC,MAAM;oBAAO;kBAAE,CAAA,GACnFwG,MAAM/I,aAAa0E,MAAM;oBAAEF,MAAM;oBAAQ5D,SAAS;sBAACkF;;kBAAS,CAAA,CAAA;;cAGlE;YACF;UACF;QACF;MACF,CAAA;IACF;EACF,CAAA;CACD;",
|
|
6
|
-
"names": ["batch", "Schema", "Effect", "pipe", "Capabilities", "createResolver", "contributes", "IntentAction", "LayoutAction", "createIntent", "chain", "getTypename", "invariant", "isLiveObject", "log", "AttentionCapabilities", "ObservabilityAction", "byPosition", "isNonNullable", "context", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "IntentAction", "ShowUndo", "resolve", "data", "layout", "requestCapability", "DeckCapabilities", "MutableDeckState", "undoPromise", "undo", "IntentDispatcher", "currentUndoId", "toasts", "filter", "toast", "id", "_tag", "Date", "now", "title", "message", "ns", "DECK_PLUGIN", "duration", "actionLabel", "actionAlt", "closeLabel", "onAction", "LayoutAction", "UpdateLayout", "Schema", "is", "UpdateSidebar", "fields", "input", "options", "next", "state", "sidebarState", "UpdateComplementary", "subject", "complementarySidebarPanel", "complementarySidebarState", "UpdateDialog", "dialogOpen", "Boolean", "dialogContent", "component", "props", "dialogBlockAlign", "blockAlign", "dialogType", "type", "UpdatePopover", "popoverOpen", "popoverContent", "popoverSide", "side", "variant", "popoverAnchor", "anchor", "popoverAnchorId", "anchorId", "AddToast", "push", "SetLayoutMode", "isLayoutMode", "mode", "setMode", "deck", "current", "solo", "active", "isNonNullable", "removed", "includes", "closed", "Array", "from", "Set", "inactive", "undefined", "initialized", "fullscreen", "batch", "getMode", "previousMode", "activeDeck", "last", "log", "warn", "SwitchWorkspace", "startsWith", "previousDeck", "decks", "defaultDeck", "first", "intents", "createIntent", "ScrollIntoView", "part", "RevertWorkspace", "Open", "Effect", "gen", "graph", "AppGraph", "attention", "AttentionCapabilities", "Attention", "settings", "requestCapabilities", "SettingsStore", "getStore", "value", "workspace", "dispatch", "previouslyOpenIds", "map", "createEntryId", "reduce", "acc", "entryId", "openEntry", "key", "positioning", "newPlankPositioning", "pivotId", "setActive", "ids", "newlyOpen", "i", "has", "scrollIntoView", "Expose", "subjectId", "findNode", "typename", "isLiveObject", "getTypename", "ObservabilityAction", "SendEvent", "name", "properties", "Close", "closeEntry", "toAttend", "clearCompanionIntents", "activeCompanions", "primary", "DeckAction", "ChangeCompanion", "companion", "UpdatePlankSize", "plankSizing", "size", "_", "nextActiveCompanions", "invariant", "Adjust", "adjustment", "incrementPlank", "node", "nodes", "n", "PLANK_COMPANION_TYPE", "toSorted", "a", "b", "byPosition", "pipe", "chain"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/tools.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport {\n contributes,\n createIntent,\n Capabilities,\n LayoutAction,\n type PromiseIntentDispatcher,\n} from '@dxos/app-framework';\nimport { defineTool, ToolResult } from '@dxos/artifact';\nimport { invariant } from '@dxos/invariant';\n\nimport { meta } from '../meta';\nimport { DeckAction } from '../types';\n\n// TODO(burdon): Factor out.\ndeclare global {\n interface ToolContextExtensions {\n dispatch?: PromiseIntentDispatcher;\n pivotId?: string;\n part?: 'deck' | 'dialog';\n }\n}\n\nexport default () =>\n contributes(Capabilities.Tools, [\n defineTool(meta.id, {\n name: 'show',\n description: `\n Show an item as a companion to an existing plank. This will make the item appear alongside the primary content.\n When supplying IDs, they must be fully qualified like space:object.\n `,\n caption: 'Showing item...',\n // TODO(wittjosiah): Refactor Layout/Navigation/Deck actions so that they can be used directly.\n schema: Schema.Struct({\n id: Schema.String.annotations({\n description: 'The ID of the item to show.',\n }),\n }),\n execute: async ({ id }, { extensions }) => {\n invariant(extensions?.pivotId, 'No pivot ID');\n invariant(extensions?.dispatch, 'No intent dispatcher');\n\n if (extensions.part === 'deck') {\n const { data, error } = await extensions.dispatch(\n createIntent(DeckAction.ChangeCompanion, {\n primary: extensions.pivotId,\n companion: id,\n }),\n );\n if (error) {\n return ToolResult.Error(error.message);\n }\n\n return ToolResult.Success(data);\n } else {\n const { data, error } = await extensions.dispatch(\n createIntent(LayoutAction.Open, {\n subject: [id],\n part: 'main',\n options: {\n pivotId: extensions.pivotId,\n positioning: 'end',\n },\n }),\n );\n if (error) {\n return ToolResult.Error(error.message);\n }\n\n return ToolResult.Success(data);\n }\n },\n }),\n ]);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;AAIA,SAASA,cAAc;AAEvB,SACEC,aACAC,cACAC,cACAC,oBAEK;AACP,SAASC,YAAYC,kBAAkB;AACvC,SAASC,iBAAiB;;AAc1B,IAAA,gBAAe,MACbC,YAAYC,aAAaC,OAAO;EAC9BC,WAAWC,KAAKC,IAAI;IAClBC,MAAM;IACNC,aAAa;;;;IAIbC,SAAS;;IAETC,QAAQC,OAAOC,OAAO;MACpBN,IAAIK,OAAOE,OAAOC,YAAY;QAC5BN,aAAa;MACf,CAAA;IACF,CAAA;IACAO,SAAS,OAAO,EAAET,GAAE,GAAI,EAAEU,WAAU,MAAE;AACpCC,gBAAUD,YAAYE,SAAS,eAAA;;;;;;;;;AAC/BD,gBAAUD,YAAYG,UAAU,wBAAA;;;;;;;;;AAEhC,UAAIH,WAAWI,SAAS,QAAQ;AAC9B,cAAM,EAAEC,MAAMC,MAAK,IAAK,MAAMN,WAAWG,SACvCI,aAAaC,WAAWC,iBAAiB;UACvCC,SAASV,WAAWE;UACpBS,WAAWrB;QACb,CAAA,CAAA;AAEF,YAAIgB,OAAO;AACT,iBAAOM,WAAWC,MAAMP,MAAMQ,OAAO;QACvC;AAEA,eAAOF,WAAWG,QAAQV,IAAAA;MAC5B,OAAO;AACL,cAAM,EAAEA,MAAMC,MAAK,IAAK,MAAMN,WAAWG,SACvCI,aAAaS,aAAaC,MAAM;UAC9BC,SAAS;YAAC5B;;UACVc,MAAM;UACNe,SAAS;YACPjB,SAASF,WAAWE;YACpBkB,aAAa;UACf;QACF,CAAA,CAAA;AAEF,YAAId,OAAO;AACT,iBAAOM,WAAWC,MAAMP,MAAMQ,OAAO;QACvC;AAEA,eAAOF,WAAWG,QAAQV,IAAAA;MAC5B;IACF;EACF,CAAA;CACD;",
|
|
6
|
-
"names": ["Schema", "contributes", "createIntent", "Capabilities", "LayoutAction", "defineTool", "ToolResult", "invariant", "contributes", "Capabilities", "Tools", "defineTool", "meta", "id", "name", "description", "caption", "schema", "Schema", "Struct", "String", "annotations", "execute", "extensions", "invariant", "pivotId", "dispatch", "part", "data", "error", "createIntent", "DeckAction", "ChangeCompanion", "primary", "companion", "ToolResult", "Error", "message", "Success", "LayoutAction", "Open", "subject", "options", "positioning"]
|
|
7
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|