@dxos/plugin-deck 0.8.1-staging.391c573 → 0.8.1-staging.9eaf14f
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-IYHAGFA3.mjs → app-graph-builder-VYZ4IWI3.mjs} +3 -3
- package/dist/lib/browser/{check-app-scheme-S3EYUPMF.mjs → check-app-scheme-SEYECDHI.mjs} +2 -2
- package/dist/lib/browser/{chunk-YCKJNTKG.mjs → chunk-6ZSOFCPP.mjs} +26 -6
- package/dist/lib/browser/chunk-6ZSOFCPP.mjs.map +7 -0
- package/dist/lib/browser/chunk-B4LOJUWW.mjs +24 -0
- package/dist/lib/browser/{chunk-Z23S33X6.mjs → chunk-FJBMNSUC.mjs} +638 -483
- package/dist/lib/browser/chunk-FJBMNSUC.mjs.map +7 -0
- package/dist/lib/browser/chunk-FLOVGNYB.mjs +81 -0
- package/dist/lib/browser/chunk-FLOVGNYB.mjs.map +7 -0
- package/dist/lib/browser/{chunk-N7TEPFVR.mjs → chunk-NSATFAEE.mjs} +3 -3
- package/dist/lib/browser/{chunk-N7TEPFVR.mjs.map → chunk-NSATFAEE.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-FYKBOM3C.mjs → chunk-RJNCG4ND.mjs} +66 -40
- package/dist/lib/browser/chunk-RJNCG4ND.mjs.map +7 -0
- package/dist/lib/browser/{chunk-22AQ5IVX.mjs → chunk-XMCG42ID.mjs} +2 -3
- package/dist/lib/browser/chunk-XMCG42ID.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +14 -9
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-P5BVUQKU.mjs → intent-resolver-UDYKO2QW.mjs} +78 -88
- package/dist/lib/browser/intent-resolver-UDYKO2QW.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-EP4UF3KA.mjs → react-root-XLXN2VEW.mjs} +8 -10
- package/dist/lib/browser/react-root-XLXN2VEW.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-5B3RLJCD.mjs → react-surface-WNGMZL7I.mjs} +11 -10
- package/dist/lib/browser/react-surface-WNGMZL7I.mjs.map +7 -0
- package/dist/lib/browser/{settings-X3P2HKQJ.mjs → settings-HMDGSBGO.mjs} +5 -4
- package/dist/lib/browser/settings-HMDGSBGO.mjs.map +7 -0
- package/dist/lib/browser/{state-2MOTLKVR.mjs → state-7TN26M42.mjs} +7 -11
- package/dist/lib/browser/state-7TN26M42.mjs.map +7 -0
- package/dist/lib/browser/tools-SC6QEN7R.mjs +78 -0
- package/dist/lib/browser/tools-SC6QEN7R.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +12 -6
- package/dist/lib/browser/{url-handler-MVHTKUYA.mjs → url-handler-ODG4B6NX.mjs} +7 -9
- package/dist/lib/browser/url-handler-ODG4B6NX.mjs.map +7 -0
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +36 -14
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-root.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +18 -6
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/tools.d.ts +1 -0
- package/dist/types/src/capabilities/tools.d.ts.map +1 -1
- package/dist/types/src/capabilities/url-handler.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ActiveNode.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Banner.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +1 -4
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/index.d.ts +1 -0
- package/dist/types/src/components/DeckLayout/index.d.ts.map +1 -1
- package/dist/types/src/components/DeckSettings/DeckSettings.d.ts +6 -0
- package/dist/types/src/components/DeckSettings/DeckSettings.d.ts.map +1 -0
- package/dist/types/src/components/DeckSettings/index.d.ts +2 -0
- package/dist/types/src/components/DeckSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/Plank/Plank.d.ts +14 -0
- package/dist/types/src/components/Plank/Plank.d.ts.map +1 -0
- package/dist/types/src/components/Plank/Plank.stories.d.ts +8 -0
- package/dist/types/src/components/Plank/Plank.stories.d.ts.map +1 -0
- package/dist/types/src/components/{DeckLayout → Plank}/PlankControls.d.ts +8 -1
- package/dist/types/src/components/Plank/PlankControls.d.ts.map +1 -0
- package/dist/types/src/components/{DeckLayout → Plank}/PlankError.d.ts +2 -2
- package/dist/types/src/components/Plank/PlankError.d.ts.map +1 -0
- package/dist/types/src/components/Plank/PlankHeading.d.ts +20 -0
- package/dist/types/src/components/Plank/PlankHeading.d.ts.map +1 -0
- package/dist/types/src/components/Plank/PlankLoading.d.ts.map +1 -0
- package/dist/types/src/components/Plank/index.d.ts +6 -0
- package/dist/types/src/components/Plank/index.d.ts.map +1 -0
- package/dist/types/src/components/Sidebar/ComplementarySidebar.d.ts.map +1 -0
- package/dist/types/src/components/Sidebar/Sidebar.d.ts.map +1 -0
- package/dist/types/src/components/Sidebar/SidebarButton.d.ts.map +1 -0
- package/dist/types/src/components/Sidebar/index.d.ts +4 -0
- package/dist/types/src/components/Sidebar/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +0 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +0 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/layout.d.ts +7 -1
- package/dist/types/src/layout.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -5
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +4 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +50 -48
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -0
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/set-active.d.ts +2 -2
- package/dist/types/src/util/set-active.d.ts.map +1 -1
- package/dist/types/src/util/useCompanions.d.ts +8 -0
- package/dist/types/src/util/useCompanions.d.ts.map +1 -0
- package/dist/types/src/util/useHoistStatusbar.d.ts.map +1 -1
- package/package.json +28 -29
- package/src/DeckPlugin.ts +0 -1
- package/src/capabilities/capabilities.ts +3 -4
- package/src/capabilities/intent-resolver.ts +63 -9
- package/src/capabilities/react-root.tsx +1 -9
- package/src/capabilities/react-surface.tsx +3 -4
- package/src/capabilities/settings.ts +7 -2
- package/src/capabilities/state.ts +4 -11
- package/src/capabilities/tools.ts +34 -22
- package/src/capabilities/url-handler.ts +2 -8
- package/src/components/DeckLayout/ActiveNode.tsx +2 -1
- package/src/components/DeckLayout/Banner.tsx +5 -3
- package/src/components/DeckLayout/ContentEmpty.tsx +1 -1
- package/src/components/DeckLayout/DeckLayout.tsx +58 -24
- package/src/components/DeckLayout/Fullscreen.tsx +1 -1
- package/src/components/DeckLayout/Toast.tsx +1 -1
- package/src/components/DeckLayout/index.ts +2 -0
- package/src/components/{LayoutSettings.tsx → DeckSettings/DeckSettings.tsx} +15 -10
- package/src/components/DeckSettings/index.ts +5 -0
- package/src/components/Plank/Plank.stories.tsx +43 -0
- package/src/components/Plank/Plank.tsx +230 -0
- package/src/components/{DeckLayout → Plank}/PlankControls.tsx +73 -27
- package/src/components/{DeckLayout → Plank}/PlankError.tsx +3 -3
- package/src/components/Plank/PlankHeading.tsx +207 -0
- package/src/components/Plank/index.ts +9 -0
- package/src/components/{DeckLayout → Sidebar}/ComplementarySidebar.tsx +65 -81
- package/src/components/Sidebar/index.ts +7 -0
- package/src/components/index.ts +1 -1
- package/src/events.ts +0 -1
- package/src/hooks/index.ts +0 -1
- package/src/index.ts +1 -0
- package/src/layout.ts +19 -2
- package/src/meta.ts +4 -4
- package/src/translations.ts +4 -0
- package/src/types.ts +81 -79
- package/src/util/index.ts +1 -0
- package/src/util/set-active.ts +2 -2
- package/src/util/useCompanions.ts +18 -0
- package/src/util/useHoistStatusbar.ts +2 -2
- package/dist/lib/browser/chunk-22AQ5IVX.mjs.map +0 -7
- package/dist/lib/browser/chunk-FYKBOM3C.mjs.map +0 -7
- package/dist/lib/browser/chunk-IZ5RPJ6T.mjs +0 -24
- package/dist/lib/browser/chunk-YCKJNTKG.mjs.map +0 -7
- package/dist/lib/browser/chunk-Z23S33X6.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-P5BVUQKU.mjs.map +0 -7
- package/dist/lib/browser/react-root-EP4UF3KA.mjs.map +0 -7
- package/dist/lib/browser/react-surface-5B3RLJCD.mjs.map +0 -7
- package/dist/lib/browser/settings-X3P2HKQJ.mjs.map +0 -7
- package/dist/lib/browser/state-2MOTLKVR.mjs.map +0 -7
- package/dist/lib/browser/tools-64LXGLYR.mjs +0 -59
- package/dist/lib/browser/tools-64LXGLYR.mjs.map +0 -7
- package/dist/lib/browser/url-handler-MVHTKUYA.mjs.map +0 -7
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts +0 -15
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/Plank.d.ts +0 -13
- package/dist/types/src/components/DeckLayout/Plank.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/PlankControls.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/PlankError.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/PlankLoading.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts.map +0 -1
- package/dist/types/src/components/DeckLayout/SidebarButton.d.ts.map +0 -1
- package/dist/types/src/components/LayoutSettings.d.ts +0 -6
- package/dist/types/src/components/LayoutSettings.d.ts.map +0 -1
- package/dist/types/src/hooks/useNode.d.ts +0 -11
- package/dist/types/src/hooks/useNode.d.ts.map +0 -1
- package/src/components/DeckLayout/NodePlankHeading.tsx +0 -148
- package/src/components/DeckLayout/Plank.tsx +0 -149
- package/src/hooks/useNode.ts +0 -46
- /package/dist/lib/browser/{app-graph-builder-IYHAGFA3.mjs.map → app-graph-builder-VYZ4IWI3.mjs.map} +0 -0
- /package/dist/lib/browser/{check-app-scheme-S3EYUPMF.mjs.map → check-app-scheme-SEYECDHI.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-IZ5RPJ6T.mjs.map → chunk-B4LOJUWW.mjs.map} +0 -0
- /package/dist/types/src/components/{DeckLayout → Plank}/PlankLoading.d.ts +0 -0
- /package/dist/types/src/components/{DeckLayout → Sidebar}/ComplementarySidebar.d.ts +0 -0
- /package/dist/types/src/components/{DeckLayout → Sidebar}/Sidebar.d.ts +0 -0
- /package/dist/types/src/components/{DeckLayout → Sidebar}/SidebarButton.d.ts +0 -0
- /package/src/components/{DeckLayout → Plank}/PlankLoading.tsx +0 -0
- /package/src/components/{DeckLayout → Sidebar}/Sidebar.tsx +0 -0
- /package/src/components/{DeckLayout → Sidebar}/SidebarButton.tsx +0 -0
package/src/types.ts
CHANGED
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import { LayoutAction } from '@dxos/app-framework';
|
|
6
6
|
import { S } from '@dxos/echo-schema';
|
|
7
|
-
import { type Node } from '@dxos/plugin-graph';
|
|
8
|
-
import { type Label } from '@dxos/react-ui';
|
|
9
|
-
import { type Position } from '@dxos/util';
|
|
10
7
|
|
|
11
8
|
import { DECK_PLUGIN } from './meta';
|
|
12
9
|
|
|
10
|
+
export { ATTENDABLE_PATH_SEPARATOR } from '@dxos/react-ui-attention';
|
|
11
|
+
|
|
12
|
+
export const PLANK_COMPANION_TYPE = 'dxos.org/plugin/deck/plank-companion';
|
|
13
|
+
export const DECK_COMPANION_TYPE = 'dxos.org/plugin/deck/deck-companion';
|
|
14
|
+
|
|
13
15
|
// TODO(Zan): In the future we should consider adding new planks adjacent to the attended plank.
|
|
14
16
|
export const NewPlankPositions = ['start', 'end'] as const;
|
|
15
17
|
export type NewPlankPositioning = (typeof NewPlankPositions)[number];
|
|
@@ -17,90 +19,53 @@ export type NewPlankPositioning = (typeof NewPlankPositions)[number];
|
|
|
17
19
|
export const OverscrollOptions = ['none', 'centering'] as const;
|
|
18
20
|
export type Overscroll = (typeof OverscrollOptions)[number];
|
|
19
21
|
|
|
20
|
-
export type
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const DeckSettingsSchema = S.mutable(
|
|
33
|
-
S.Struct({
|
|
34
|
-
showHints: S.Boolean,
|
|
35
|
-
enableNativeRedirect: S.Boolean,
|
|
36
|
-
enableStatusbar: S.Boolean,
|
|
37
|
-
newPlankPositioning: S.Literal(...NewPlankPositions),
|
|
38
|
-
overscroll: S.Literal(...OverscrollOptions),
|
|
39
|
-
}),
|
|
40
|
-
);
|
|
41
|
-
|
|
22
|
+
export type Part = 'solo' | 'deck' | 'complementary';
|
|
23
|
+
export type ResolvedPart = Part | 'solo-primary' | 'solo-companion';
|
|
24
|
+
|
|
25
|
+
export const DeckSettingsSchema = S.Struct({
|
|
26
|
+
showHints: S.optional(S.Boolean),
|
|
27
|
+
enableDeck: S.optional(S.Boolean),
|
|
28
|
+
enableNativeRedirect: S.optional(S.Boolean),
|
|
29
|
+
enableStatusbar: S.optional(S.Boolean),
|
|
30
|
+
newPlankPositioning: S.optional(S.Literal(...NewPlankPositions)),
|
|
31
|
+
overscroll: S.optional(S.Literal(...OverscrollOptions)),
|
|
32
|
+
}).pipe(S.mutable);
|
|
42
33
|
export type DeckSettingsProps = S.Schema.Type<typeof DeckSettingsSchema>;
|
|
43
34
|
|
|
44
|
-
const LayoutMode = S.Union(S.Literal('deck'), S.Literal('solo'), S.Literal('fullscreen'));
|
|
45
|
-
export const isLayoutMode = (value: any): value is LayoutMode => S.is(LayoutMode)(value);
|
|
46
|
-
export type LayoutMode = S.Schema.Type<typeof LayoutMode>;
|
|
47
|
-
|
|
48
35
|
export const PlankSizing = S.Record({ key: S.String, value: S.Number });
|
|
49
36
|
export type PlankSizing = S.Schema.Type<typeof PlankSizing>;
|
|
50
37
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
38
|
+
// State of an individual deck.
|
|
39
|
+
export const DeckState = S.Struct({
|
|
40
|
+
/** If false, the deck has not yet left solo mode and new planks should be soloed. */
|
|
41
|
+
initialized: S.Boolean,
|
|
55
42
|
active: S.mutable(S.Array(S.String)),
|
|
43
|
+
// TODO(wittjosiah): Piping into both mutable and optional caused invalid typescript output.
|
|
44
|
+
activeCompanions: S.optional(S.mutable(S.Record({ key: S.String, value: S.String }))),
|
|
56
45
|
inactive: S.mutable(S.Array(S.String)),
|
|
57
46
|
solo: S.optional(S.String),
|
|
58
47
|
fullscreen: S.Boolean,
|
|
59
48
|
plankSizing: S.mutable(PlankSizing),
|
|
49
|
+
companionFrameSizing: S.mutable(PlankSizing),
|
|
60
50
|
});
|
|
61
|
-
export type Deck = S.Schema.Type<typeof Deck>;
|
|
62
|
-
|
|
63
|
-
export const DeckState = S.mutable(
|
|
64
|
-
S.Struct({
|
|
65
|
-
sidebarState: S.Literal('closed', 'collapsed', 'expanded'),
|
|
66
|
-
complementarySidebarState: S.Literal('closed', 'collapsed', 'expanded'),
|
|
67
|
-
complementarySidebarPanel: S.optional(S.String),
|
|
68
|
-
|
|
69
|
-
dialogOpen: S.Boolean,
|
|
70
|
-
/**
|
|
71
|
-
* Data to be passed to the dialog Surface.
|
|
72
|
-
*/
|
|
73
|
-
dialogContent: S.optional(S.Any),
|
|
74
|
-
dialogBlockAlign: S.optional(S.Literal('start', 'center', 'end')),
|
|
75
|
-
dialogType: S.optional(S.Literal('default', 'alert')),
|
|
76
|
-
|
|
77
|
-
popoverOpen: S.Boolean,
|
|
78
|
-
popoverSide: S.optional(S.Literal('top', 'right', 'bottom', 'left')),
|
|
79
|
-
/**
|
|
80
|
-
* Data to be passed to the popover Surface.
|
|
81
|
-
*/
|
|
82
|
-
popoverContent: S.optional(S.Any),
|
|
83
|
-
popoverAnchorId: S.optional(S.String),
|
|
84
|
-
|
|
85
|
-
toasts: S.mutable(S.Array(LayoutAction.Toast)),
|
|
86
|
-
currentUndoId: S.optional(S.String),
|
|
87
|
-
|
|
88
|
-
activeDeck: S.String,
|
|
89
|
-
previousDeck: S.String,
|
|
90
|
-
decks: S.mutable(S.Record({ key: S.String, value: S.mutable(Deck) })),
|
|
91
|
-
previousMode: S.mutable(S.Record({ key: S.String, value: LayoutMode })),
|
|
92
|
-
deck: S.mutable(Deck),
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* The identifier of a component to scroll into view when it is mounted.
|
|
96
|
-
*/
|
|
97
|
-
scrollIntoView: S.optional(S.String),
|
|
98
|
-
}),
|
|
99
|
-
);
|
|
100
|
-
|
|
101
51
|
export type DeckState = S.Schema.Type<typeof DeckState>;
|
|
102
52
|
|
|
103
|
-
export const
|
|
53
|
+
export const defaultDeck: DeckState = {
|
|
54
|
+
initialized: false,
|
|
55
|
+
active: [],
|
|
56
|
+
activeCompanions: {},
|
|
57
|
+
inactive: [],
|
|
58
|
+
solo: undefined,
|
|
59
|
+
fullscreen: false,
|
|
60
|
+
plankSizing: {},
|
|
61
|
+
companionFrameSizing: {},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const LayoutMode = S.Literal('deck', 'solo', 'fullscreen');
|
|
65
|
+
export type LayoutMode = S.Schema.Type<typeof LayoutMode>;
|
|
66
|
+
export const isLayoutMode = (value: any): value is LayoutMode => S.is(LayoutMode)(value);
|
|
67
|
+
|
|
68
|
+
export const getMode = (deck: DeckState): LayoutMode => {
|
|
104
69
|
if (deck.solo) {
|
|
105
70
|
return deck.fullscreen ? 'fullscreen' : 'solo';
|
|
106
71
|
}
|
|
@@ -108,14 +73,45 @@ export const getMode = (deck: Deck): LayoutMode => {
|
|
|
108
73
|
return 'deck';
|
|
109
74
|
};
|
|
110
75
|
|
|
111
|
-
//
|
|
112
|
-
export const
|
|
76
|
+
// State of the deck plugin.
|
|
77
|
+
export const DeckPluginState = S.Struct({
|
|
78
|
+
sidebarState: S.Literal('closed', 'collapsed', 'expanded'),
|
|
79
|
+
complementarySidebarState: S.Literal('closed', 'collapsed', 'expanded'),
|
|
80
|
+
complementarySidebarPanel: S.optional(S.String),
|
|
81
|
+
|
|
82
|
+
dialogOpen: S.Boolean,
|
|
83
|
+
/** Data to be passed to the dialog Surface. */
|
|
84
|
+
dialogContent: S.optional(S.Any),
|
|
85
|
+
dialogBlockAlign: S.optional(S.Literal('start', 'center', 'end')),
|
|
86
|
+
dialogType: S.optional(S.Literal('default', 'alert')),
|
|
87
|
+
|
|
88
|
+
popoverOpen: S.Boolean,
|
|
89
|
+
popoverSide: S.optional(S.Literal('top', 'right', 'bottom', 'left')),
|
|
90
|
+
/** Data to be passed to the popover Surface. */
|
|
91
|
+
popoverContent: S.optional(S.Any),
|
|
92
|
+
popoverAnchorId: S.optional(S.String),
|
|
93
|
+
|
|
94
|
+
toasts: S.mutable(S.Array(LayoutAction.Toast)),
|
|
95
|
+
currentUndoId: S.optional(S.String),
|
|
96
|
+
|
|
97
|
+
activeDeck: S.String,
|
|
98
|
+
previousDeck: S.String,
|
|
99
|
+
decks: S.mutable(S.Record({ key: S.String, value: S.mutable(DeckState) })),
|
|
100
|
+
previousMode: S.mutable(S.Record({ key: S.String, value: LayoutMode })),
|
|
101
|
+
deck: S.mutable(DeckState),
|
|
102
|
+
|
|
103
|
+
/** The identifier of a component to scroll into view when it is mounted. */
|
|
104
|
+
scrollIntoView: S.optional(S.String),
|
|
105
|
+
}).pipe(S.mutable);
|
|
106
|
+
|
|
107
|
+
export type DeckPluginState = S.Schema.Type<typeof DeckPluginState>;
|
|
113
108
|
|
|
114
109
|
export const DECK_ACTION = `${DECK_PLUGIN}/action`;
|
|
115
110
|
|
|
116
111
|
export namespace DeckAction {
|
|
117
112
|
const PartAdjustmentSchema = S.Union(
|
|
118
113
|
S.Literal('close').annotations({ description: 'Close the plank.' }),
|
|
114
|
+
S.Literal('companion').annotations({ description: 'Open the companion plank.' }),
|
|
119
115
|
S.Literal('solo').annotations({ description: 'Solo the plank.' }),
|
|
120
116
|
S.Literal('increment-start').annotations({ description: 'Move the plank towards the start of the deck.' }),
|
|
121
117
|
S.Literal('increment-end').annotations({ description: 'Move the plank towards the end of the deck.' }),
|
|
@@ -124,9 +120,7 @@ export namespace DeckAction {
|
|
|
124
120
|
export const Adjustment = S.mutable(S.Struct({ id: S.String, type: PartAdjustmentSchema }));
|
|
125
121
|
export type Adjustment = S.Schema.Type<typeof Adjustment>;
|
|
126
122
|
|
|
127
|
-
|
|
128
|
-
* An atomic transaction to apply to the deck, describing which element to move to which location.
|
|
129
|
-
*/
|
|
123
|
+
// An atomic transaction to apply to the deck, describing which element to move to which location.
|
|
130
124
|
export class Adjust extends S.TaggedClass<Adjust>()(`${DECK_ACTION}/adjust`, {
|
|
131
125
|
input: Adjustment,
|
|
132
126
|
output: S.Void,
|
|
@@ -139,4 +133,12 @@ export namespace DeckAction {
|
|
|
139
133
|
}),
|
|
140
134
|
output: S.Void,
|
|
141
135
|
}) {}
|
|
136
|
+
|
|
137
|
+
export class ChangeCompanion extends S.TaggedClass<ChangeCompanion>()(`${DECK_ACTION}/change-companion`, {
|
|
138
|
+
input: S.Struct({
|
|
139
|
+
primary: S.String,
|
|
140
|
+
companion: S.Union(S.String, S.Null),
|
|
141
|
+
}),
|
|
142
|
+
output: S.Void,
|
|
143
|
+
}) {}
|
|
142
144
|
}
|
package/src/util/index.ts
CHANGED
package/src/util/set-active.ts
CHANGED
|
@@ -6,11 +6,11 @@ import { batch } from '@preact/signals-core';
|
|
|
6
6
|
|
|
7
7
|
import { type AttentionManager } from '@dxos/plugin-attention';
|
|
8
8
|
|
|
9
|
-
import { type
|
|
9
|
+
import { type DeckPluginState } from '../types';
|
|
10
10
|
|
|
11
11
|
export type SetActiveOptions = {
|
|
12
12
|
next: string[];
|
|
13
|
-
state:
|
|
13
|
+
state: DeckPluginState;
|
|
14
14
|
attention?: AttentionManager;
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { useAppGraph } from '@dxos/app-framework';
|
|
8
|
+
import { useNode } from '@dxos/plugin-graph';
|
|
9
|
+
import { byPosition } from '@dxos/util';
|
|
10
|
+
|
|
11
|
+
import { PLANK_COMPANION_TYPE } from '../types';
|
|
12
|
+
|
|
13
|
+
export const useCompanions = (id?: string) => {
|
|
14
|
+
const { graph } = useAppGraph();
|
|
15
|
+
const node = useNode(graph, id);
|
|
16
|
+
const companions = node ? graph.nodes(node, { type: PLANK_COMPANION_TYPE }) : [];
|
|
17
|
+
return useMemo(() => companions.toSorted((a, b) => byPosition(a.properties, b.properties)), [companions]);
|
|
18
|
+
};
|
|
@@ -10,11 +10,11 @@ import { useThemeContext } from '@dxos/react-ui';
|
|
|
10
10
|
import { DECK_PLUGIN } from '../meta';
|
|
11
11
|
import type { DeckSettingsProps } from '../types';
|
|
12
12
|
|
|
13
|
-
export const useHoistStatusbar = (breakpoint: string) => {
|
|
13
|
+
export const useHoistStatusbar = (breakpoint: string): boolean => {
|
|
14
14
|
const enableStatusbar = useCapability(Capabilities.SettingsStore).getStore<DeckSettingsProps>(DECK_PLUGIN)!.value
|
|
15
15
|
.enableStatusbar;
|
|
16
16
|
const { safeAreaPadding } = useThemeContext();
|
|
17
17
|
return useMemo(() => {
|
|
18
|
-
return breakpoint === 'desktop' && enableStatusbar && safeAreaPadding?.bottom === 0;
|
|
18
|
+
return breakpoint === 'desktop' && !!enableStatusbar && safeAreaPadding?.bottom === 0;
|
|
19
19
|
}, [enableStatusbar, breakpoint, safeAreaPadding?.bottom]);
|
|
20
20
|
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/capabilities.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineCapability } from '@dxos/app-framework';\nimport { type DeepReadonly } from '@dxos/util';\n\nimport { DECK_PLUGIN } from '../meta';\nimport { type DeckState, type Panel } from '../types';\n\nexport namespace DeckCapabilities {\n export const DeckState = defineCapability<DeepReadonly<DeckState>>(`${DECK_PLUGIN}/capability/state`);\n export const MutableDeckState = defineCapability<DeckState>(`${DECK_PLUGIN}/capability/state`);\n export const ComplementaryPanel = defineCapability<Panel>(`${DECK_PLUGIN}/capability/complementary-panel`);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,wBAAwB;;UAMhBC,mBAAAA;oBACFC,YAAYC,iBAA0C,GAAGC,WAAAA,mBAA8B;oBACvFC,mBAAmBF,iBAA4B,GAAGC,WAAAA,mBAA8B;oBAChFE,qBAAqBH,iBAAwB,GAAGC,WAAAA,iCAA4C;AAC3G,GAJiBH,qBAAAA,mBAAAA,CAAAA,EAAAA;",
|
|
6
|
-
"names": ["defineCapability", "DeckCapabilities", "DeckState", "defineCapability", "DECK_PLUGIN", "MutableDeckState", "ComplementaryPanel"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { LayoutAction } from '@dxos/app-framework';\nimport { S } from '@dxos/echo-schema';\nimport { type Node } from '@dxos/plugin-graph';\nimport { type Label } from '@dxos/react-ui';\nimport { type Position } from '@dxos/util';\n\nimport { DECK_PLUGIN } from './meta';\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 Panel = {\n id: string;\n label: Label;\n icon: string;\n position?: Position;\n /**\n * If true, the panel will now be wrapped in a scroll area.\n */\n fixed?: boolean;\n filter?: (node: Node) => boolean;\n};\n\nexport const DeckSettingsSchema = S.mutable(\n S.Struct({\n showHints: S.Boolean,\n enableNativeRedirect: S.Boolean,\n enableStatusbar: S.Boolean,\n newPlankPositioning: S.Literal(...NewPlankPositions),\n overscroll: S.Literal(...OverscrollOptions),\n }),\n);\n\nexport type DeckSettingsProps = S.Schema.Type<typeof DeckSettingsSchema>;\n\nconst LayoutMode = S.Union(S.Literal('deck'), S.Literal('solo'), S.Literal('fullscreen'));\nexport const isLayoutMode = (value: any): value is LayoutMode => S.is(LayoutMode)(value);\nexport type LayoutMode = S.Schema.Type<typeof LayoutMode>;\n\nexport const PlankSizing = S.Record({ key: S.String, value: S.Number });\nexport type PlankSizing = S.Schema.Type<typeof PlankSizing>;\n\nexport const Deck = S.Struct({\n initialized: S.Boolean.annotations({\n description: \"If false, the deck has not yet left solo mode and new planks should be solo'd.\",\n }),\n active: S.mutable(S.Array(S.String)),\n inactive: S.mutable(S.Array(S.String)),\n solo: S.optional(S.String),\n fullscreen: S.Boolean,\n plankSizing: S.mutable(PlankSizing),\n});\nexport type Deck = S.Schema.Type<typeof Deck>;\n\nexport const DeckState = S.mutable(\n S.Struct({\n sidebarState: S.Literal('closed', 'collapsed', 'expanded'),\n complementarySidebarState: S.Literal('closed', 'collapsed', 'expanded'),\n complementarySidebarPanel: S.optional(S.String),\n\n dialogOpen: S.Boolean,\n /**\n * Data to be passed to the dialog Surface.\n */\n dialogContent: S.optional(S.Any),\n dialogBlockAlign: S.optional(S.Literal('start', 'center', 'end')),\n dialogType: S.optional(S.Literal('default', 'alert')),\n\n popoverOpen: S.Boolean,\n popoverSide: S.optional(S.Literal('top', 'right', 'bottom', 'left')),\n /**\n * Data to be passed to the popover Surface.\n */\n popoverContent: S.optional(S.Any),\n popoverAnchorId: S.optional(S.String),\n\n toasts: S.mutable(S.Array(LayoutAction.Toast)),\n currentUndoId: S.optional(S.String),\n\n activeDeck: S.String,\n previousDeck: S.String,\n decks: S.mutable(S.Record({ key: S.String, value: S.mutable(Deck) })),\n previousMode: S.mutable(S.Record({ key: S.String, value: LayoutMode })),\n deck: S.mutable(Deck),\n\n /**\n * The identifier of a component to scroll into view when it is mounted.\n */\n scrollIntoView: S.optional(S.String),\n }),\n);\n\nexport type DeckState = S.Schema.Type<typeof DeckState>;\n\nexport const getMode = (deck: Deck): LayoutMode => {\n if (deck.solo) {\n return deck.fullscreen ? 'fullscreen' : 'solo';\n }\n\n return 'deck';\n};\n\n// NOTE: Chosen from RFC 1738’s `safe` characters: http://www.faqs.org/rfcs/rfc1738.html\nexport const SLUG_PATH_SEPARATOR = '~';\n\nexport const DECK_ACTION = `${DECK_PLUGIN}/action`;\n\nexport namespace DeckAction {\n const PartAdjustmentSchema = S.Union(\n S.Literal('close').annotations({ description: 'Close the plank.' }),\n S.Literal('solo').annotations({ description: 'Solo the plank.' }),\n S.Literal('increment-start').annotations({ description: 'Move the plank towards the start of the deck.' }),\n S.Literal('increment-end').annotations({ description: 'Move the plank towards the end of the deck.' }),\n );\n export type PartAdjustment = S.Schema.Type<typeof PartAdjustmentSchema>;\n export const Adjustment = S.mutable(S.Struct({ id: S.String, type: PartAdjustmentSchema }));\n export type Adjustment = S.Schema.Type<typeof Adjustment>;\n\n /**\n * An atomic transaction to apply to the deck, describing which element to move to which location.\n */\n export class Adjust extends S.TaggedClass<Adjust>()(`${DECK_ACTION}/adjust`, {\n input: Adjustment,\n output: S.Void,\n }) {}\n\n export class UpdatePlankSize extends S.TaggedClass<UpdatePlankSize>()(`${DECK_ACTION}/update-plank-size`, {\n input: S.Struct({\n id: S.String,\n size: S.Number,\n }),\n output: S.Void,\n }) {}\n}\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": ["LayoutAction", "S", "NewPlankPositions", "OverscrollOptions", "DeckSettingsSchema", "S", "mutable", "Struct", "showHints", "Boolean", "enableNativeRedirect", "enableStatusbar", "newPlankPositioning", "Literal", "overscroll", "LayoutMode", "Union", "isLayoutMode", "value", "is", "PlankSizing", "Record", "key", "String", "Number", "Deck", "initialized", "annotations", "description", "active", "Array", "inactive", "solo", "optional", "fullscreen", "plankSizing", "DeckState", "sidebarState", "complementarySidebarState", "complementarySidebarPanel", "dialogOpen", "dialogContent", "Any", "dialogBlockAlign", "dialogType", "popoverOpen", "popoverSide", "popoverContent", "popoverAnchorId", "toasts", "LayoutAction", "Toast", "currentUndoId", "activeDeck", "previousDeck", "decks", "previousMode", "deck", "scrollIntoView", "getMode", "SLUG_PATH_SEPARATOR", "DECK_ACTION", "DECK_PLUGIN", "DeckAction", "PartAdjustmentSchema", "Adjustment", "id", "type", "Adjust", "TaggedClass", "input", "output", "Void", "UpdatePlankSize", "size"]
|
|
7
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// packages/plugins/plugin-deck/src/capabilities/index.ts
|
|
2
|
-
import { lazy } from "@dxos/app-framework";
|
|
3
|
-
var AppGraphBuilder = lazy(() => import("./app-graph-builder-IYHAGFA3.mjs"));
|
|
4
|
-
var CheckAppScheme = lazy(() => import("./check-app-scheme-S3EYUPMF.mjs"));
|
|
5
|
-
var LayoutIntentResolver = lazy(() => import("./intent-resolver-P5BVUQKU.mjs"));
|
|
6
|
-
var ReactRoot = lazy(() => import("./react-root-EP4UF3KA.mjs"));
|
|
7
|
-
var ReactSurface = lazy(() => import("./react-surface-5B3RLJCD.mjs"));
|
|
8
|
-
var DeckSettings = lazy(() => import("./settings-X3P2HKQJ.mjs"));
|
|
9
|
-
var DeckState = lazy(() => import("./state-2MOTLKVR.mjs"));
|
|
10
|
-
var Tools = lazy(() => import("./tools-64LXGLYR.mjs"));
|
|
11
|
-
var UrlHandler = lazy(() => import("./url-handler-MVHTKUYA.mjs"));
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
AppGraphBuilder,
|
|
15
|
-
CheckAppScheme,
|
|
16
|
-
LayoutIntentResolver,
|
|
17
|
-
ReactRoot,
|
|
18
|
-
ReactSurface,
|
|
19
|
-
DeckSettings,
|
|
20
|
-
DeckState,
|
|
21
|
-
Tools,
|
|
22
|
-
UrlHandler
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=chunk-IZ5RPJ6T.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/util/set-active.ts", "../../../src/util/overscroll.ts", "../../../src/util/useBreakpoints.ts", "../../../src/util/layoutAppliesTopbar.ts", "../../../src/util/useHoistStatusbar.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { batch } from '@preact/signals-core';\n\nimport { type AttentionManager } from '@dxos/plugin-attention';\n\nimport { type DeckState } from '../types';\n\nexport type SetActiveOptions = {\n next: string[];\n state: DeckState;\n attention?: AttentionManager;\n};\n\nexport const setActive = ({ next, state, attention }: SetActiveOptions) => {\n return batch(() => {\n const active = state.deck.solo ? [state.deck.solo] : state.deck.active;\n const removed = active.filter((id) => !next.includes(id));\n const closed = Array.from(new Set([...state.deck.inactive.filter((id) => !next.includes(id)), ...removed]));\n\n state.deck.inactive = closed;\n\n if (state.deck.solo || !state.deck.initialized) {\n state.deck.solo = next[0];\n } else {\n state.deck.active = next;\n }\n\n if (state.deck.fullscreen && !state.deck.solo) {\n state.deck.fullscreen = false;\n }\n\n if (attention) {\n const attended = attention.current;\n const [attendedId] = Array.from(attended);\n const isAttendedAvailable = !!attendedId && next.includes(attendedId);\n if (!isAttendedAvailable) {\n const attendedIndex = active.indexOf(attendedId);\n // If outside of bounds, focus on the first/last plank, otherwise focus on the new plank in the same position.\n const index = attendedIndex === -1 ? 0 : attendedIndex >= next.length ? next.length - 1 : attendedIndex;\n return next[index];\n }\n }\n });\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport type { CSSProperties } from 'react';\n\n/**\n * ┌────────────────────────────────────────────────────────────────────────────────────────────────────┐\n * | Overscroll Padding Calculation for Centering Planks on Screen. │\n * ├────────────────────────────────────────────────────────────────────────────────────────────────────┤\n * │ NOTE(Zan): I found the way you calculate the overscroll padding to center a plank on the screen │\n * │ at the edges of the scroll context a bit confusing, so I've diagrammed it here. │\n * │ │\n * │ Multiple Planks: │\n * │ ─────────────── │\n * | Use the following overscroll padding calculation centering the boundary planks on the SCREEN. │\n * │ │\n * │ Left Padding: Right Padding: │\n * │ ┌───┬────┬──────────────────┬──────┐ ┌──────┬──────────────────┬────┬───┐ │\n * │ │ │████│ Ideal │ │ │ │ Ideal │████│ │ │\n * │ │ S │█PL█│ first │ │ │ │ last │█PR█│ C │ │\n * │ │ │████│ plank │ │ │ │ plank │████│ │ │\n * │ └───┴────┴──────────────────┴──────┘ └──────┴──────────────────┴────┴───┘ │\n * │ <--------- screen width -----------> <---------- screen width ----------> │\n * │ │\n * │ PL = ((screen width - Plank Width) / 2) - S │\n * │ PR = ((screen width - Plank Width) / 2) - C │\n * │ │\n * │ S = Sidebar width C = Complementary sidebar width │\n * │ PL = Padding Left PR = Padding Right │\n * │ │\n * │ Single Plank: │\n * │ ───────────── │\n * │ For a single plank we use the following overscroll padding calculation to center the plank in │\n * │ the content area: │\n * │ │\n * │ ┌───┬───────────────────────┬───┬───────────────────────┬───┐ │\n * │ │ │███████████████████████│ │███████████████████████│ │ │\n * │ │ S │█████ Left Padding ████│ P │████ Right Padding ████│ C │ │\n * │ │ │███████████████████████│ │███████████████████████│ │ │\n * │ └───┴───────────────────────┴───┴───────────────────────┴───┘ │\n * │ <------------------------ screen width ---------------------> │\n * │ │\n * │ Left/Right Padding Width = (screen width - S - P - C) / 2 │\n * │ │\n * │ S = Sidebar width (may be 0) │\n * │ P = Plank width (centered) │\n * │ C = Complementary sidebar width (may be 0) │\n * └────────────────────────────────────────────────────────────────────────────────────────────────────┘\n */\nexport const calculateOverscroll = (\n planksCount: number,\n): Pick<CSSProperties, 'paddingInlineStart' | 'paddingInlineEnd'> | undefined => {\n if (!planksCount) {\n return { paddingInlineStart: 0, paddingInlineEnd: 0 };\n }\n if (planksCount === 1) {\n const overscrollPadding =\n 'max(0px, calc(((100dvw - var(--dx-main-sidebarWidth) - var(--dx-main-complementaryWidth) - (var(--dx-main-contentFirstWidth) + 1px)) / 2)))';\n return { paddingInlineStart: overscrollPadding, paddingInlineEnd: overscrollPadding };\n } else {\n return {\n paddingInlineStart:\n 'max(0px, calc(((100dvw - (var(--dx-main-contentFirstWidth) + 1px)) / 2) - var(--dx-main-sidebarWidth)))',\n paddingInlineEnd:\n 'max(0px, calc(((100dvw - (var(--dx-main-contentLastWidth) + 1px)) / 2) - var(--dx-main-complementaryWidth)))',\n };\n }\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useMediaQuery } from '@dxos/react-ui';\n\nexport const useBreakpoints = () => {\n const [isNotMobile] = useMediaQuery('md');\n const [isDesktop] = useMediaQuery('lg');\n return isDesktop ? 'desktop' : isNotMobile ? 'tablet' : 'mobile';\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nexport const layoutAppliesTopbar = (breakpoint: string) => {\n return document.body.getAttribute('data-platform') === 'win' && breakpoint === 'desktop';\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useMemo } from 'react';\n\nimport { Capabilities, useCapability } from '@dxos/app-framework';\nimport { useThemeContext } from '@dxos/react-ui';\n\nimport { DECK_PLUGIN } from '../meta';\nimport type { DeckSettingsProps } from '../types';\n\nexport const useHoistStatusbar = (breakpoint: string) => {\n const enableStatusbar = useCapability(Capabilities.SettingsStore).getStore<DeckSettingsProps>(DECK_PLUGIN)!.value\n .enableStatusbar;\n const { safeAreaPadding } = useThemeContext();\n return useMemo(() => {\n return breakpoint === 'desktop' && enableStatusbar && safeAreaPadding?.bottom === 0;\n }, [enableStatusbar, breakpoint, safeAreaPadding?.bottom]);\n};\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,aAAa;AAYf,IAAMC,YAAY,CAAC,EAAEC,MAAMC,OAAOC,UAAS,MAAoB;AACpE,SAAOC,MAAM,MAAA;AACX,UAAMC,SAASH,MAAMI,KAAKC,OAAO;MAACL,MAAMI,KAAKC;QAAQL,MAAMI,KAAKD;AAChE,UAAMG,UAAUH,OAAOI,OAAO,CAACC,OAAO,CAACT,KAAKU,SAASD,EAAAA,CAAAA;AACrD,UAAME,SAASC,MAAMC,KAAK,oBAAIC,IAAI;SAAIb,MAAMI,KAAKU,SAASP,OAAO,CAACC,OAAO,CAACT,KAAKU,SAASD,EAAAA,CAAAA;SAASF;KAAQ,CAAA;AAEzGN,UAAMI,KAAKU,WAAWJ;AAEtB,QAAIV,MAAMI,KAAKC,QAAQ,CAACL,MAAMI,KAAKW,aAAa;AAC9Cf,YAAMI,KAAKC,OAAON,KAAK,CAAA;IACzB,OAAO;AACLC,YAAMI,KAAKD,SAASJ;IACtB;AAEA,QAAIC,MAAMI,KAAKY,cAAc,CAAChB,MAAMI,KAAKC,MAAM;AAC7CL,YAAMI,KAAKY,aAAa;IAC1B;AAEA,QAAIf,WAAW;AACb,YAAMgB,WAAWhB,UAAUiB;AAC3B,YAAM,CAACC,UAAAA,IAAcR,MAAMC,KAAKK,QAAAA;AAChC,YAAMG,sBAAsB,CAAC,CAACD,cAAcpB,KAAKU,SAASU,UAAAA;AAC1D,UAAI,CAACC,qBAAqB;AACxB,cAAMC,gBAAgBlB,OAAOmB,QAAQH,UAAAA;AAErC,cAAMI,QAAQF,kBAAkB,KAAK,IAAIA,iBAAiBtB,KAAKyB,SAASzB,KAAKyB,SAAS,IAAIH;AAC1F,eAAOtB,KAAKwB,KAAAA;MACd;IACF;EACF,CAAA;AACF;;;ACIO,IAAME,sBAAsB,CACjCC,gBAAAA;AAEA,MAAI,CAACA,aAAa;AAChB,WAAO;MAAEC,oBAAoB;MAAGC,kBAAkB;IAAE;EACtD;AACA,MAAIF,gBAAgB,GAAG;AACrB,UAAMG,oBACJ;AACF,WAAO;MAAEF,oBAAoBE;MAAmBD,kBAAkBC;IAAkB;EACtF,OAAO;AACL,WAAO;MACLF,oBACE;MACFC,kBACE;IACJ;EACF;AACF;;;AChEA,SAASE,qBAAqB;AAEvB,IAAMC,iBAAiB,MAAA;AAC5B,QAAM,CAACC,WAAAA,IAAeC,cAAc,IAAA;AACpC,QAAM,CAACC,SAAAA,IAAaD,cAAc,IAAA;AAClC,SAAOC,YAAY,YAAYF,cAAc,WAAW;AAC1D;;;ACNO,IAAMG,sBAAsB,CAACC,eAAAA;AAClC,SAAOC,SAASC,KAAKC,aAAa,eAAA,MAAqB,SAASH,eAAe;AACjF;;;ACFA,SAASI,eAAe;AAExB,SAASC,cAAcC,qBAAqB;AAC5C,SAASC,uBAAuB;AAKzB,IAAMC,oBAAoB,CAACC,eAAAA;AAChC,QAAMC,kBAAkBC,cAAcC,aAAaC,aAAa,EAAEC,SAA4BC,WAAAA,EAAcC,MACzGN;AACH,QAAM,EAAEO,gBAAe,IAAKC,gBAAAA;AAC5B,SAAOC,QAAQ,MAAA;AACb,WAAOV,eAAe,aAAaC,mBAAmBO,iBAAiBG,WAAW;EACpF,GAAG;IAACV;IAAiBD;IAAYQ,iBAAiBG;GAAO;AAC3D;",
|
|
6
|
-
"names": ["batch", "setActive", "next", "state", "attention", "batch", "active", "deck", "solo", "removed", "filter", "id", "includes", "closed", "Array", "from", "Set", "inactive", "initialized", "fullscreen", "attended", "current", "attendedId", "isAttendedAvailable", "attendedIndex", "indexOf", "index", "length", "calculateOverscroll", "planksCount", "paddingInlineStart", "paddingInlineEnd", "overscrollPadding", "useMediaQuery", "useBreakpoints", "isNotMobile", "useMediaQuery", "isDesktop", "layoutAppliesTopbar", "breakpoint", "document", "body", "getAttribute", "useMemo", "Capabilities", "useCapability", "useThemeContext", "useHoistStatusbar", "breakpoint", "enableStatusbar", "useCapability", "Capabilities", "SettingsStore", "getStore", "DECK_PLUGIN", "value", "safeAreaPadding", "useThemeContext", "useMemo", "bottom"]
|
|
7
|
-
}
|