@dxos/plugin-deck 0.7.4 → 0.7.5-labs.071a3e2
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-CI6ZFMNL.mjs +147 -0
- package/dist/lib/browser/app-graph-builder-CI6ZFMNL.mjs.map +7 -0
- package/dist/lib/browser/check-app-scheme-S3EYUPMF.mjs +33 -0
- package/dist/lib/browser/check-app-scheme-S3EYUPMF.mjs.map +7 -0
- package/dist/lib/browser/chunk-BTDY6SES.mjs +1119 -0
- package/dist/lib/browser/chunk-BTDY6SES.mjs.map +7 -0
- package/dist/lib/browser/chunk-FZOBKOA2.mjs +24 -0
- package/dist/lib/browser/chunk-FZOBKOA2.mjs.map +7 -0
- package/dist/lib/browser/chunk-M2L53AIH.mjs +126 -0
- package/dist/lib/browser/chunk-M2L53AIH.mjs.map +7 -0
- package/dist/lib/browser/{chunk-GVOGPULO.mjs → chunk-N7TEPFVR.mjs} +5 -4
- package/dist/lib/browser/chunk-N7TEPFVR.mjs.map +7 -0
- package/dist/lib/browser/chunk-YQ2GWTDU.mjs +17 -0
- package/dist/lib/browser/chunk-YQ2GWTDU.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +100 -1807
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-CSXFDKTC.mjs +494 -0
- package/dist/lib/browser/intent-resolver-CSXFDKTC.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-root-HIHLRMCW.mjs +46 -0
- package/dist/lib/browser/react-root-HIHLRMCW.mjs.map +7 -0
- package/dist/lib/browser/react-surface-4QVWKQYY.mjs +38 -0
- package/dist/lib/browser/react-surface-4QVWKQYY.mjs.map +7 -0
- package/dist/lib/browser/settings-WACNLCPB.mjs +28 -0
- package/dist/lib/browser/settings-WACNLCPB.mjs.map +7 -0
- package/dist/lib/browser/state-VPOYUKK6.mjs +117 -0
- package/dist/lib/browser/state-VPOYUKK6.mjs.map +7 -0
- package/dist/lib/browser/tools-5LDJNU56.mjs +51 -0
- package/dist/lib/browser/tools-5LDJNU56.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +20 -3
- package/dist/lib/browser/url-handler-HLF42IHP.mjs +70 -0
- package/dist/lib/browser/url-handler-HLF42IHP.mjs.map +7 -0
- package/dist/types/src/DeckPlugin.d.ts +1 -14
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +142 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/check-app-scheme.d.ts +4 -0
- package/dist/types/src/capabilities/check-app-scheme.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +190 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root.d.ts +7 -0
- package/dist/types/src/capabilities/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +4 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/set-active.d.ts +9 -0
- package/dist/types/src/capabilities/set-active.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +4 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +76 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/tools.d.ts +10 -0
- package/dist/types/src/capabilities/tools.d.ts.map +1 -0
- package/dist/types/src/capabilities/url-handler.d.ts +4 -0
- package/dist/types/src/capabilities/url-handler.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/ActiveNode.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Banner.d.ts +6 -0
- package/dist/types/src/components/DeckLayout/Banner.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ContentEmpty.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/Fullscreen.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts +3 -3
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Plank.d.ts +8 -6
- package/dist/types/src/components/DeckLayout/Plank.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/PlankControls.d.ts +2 -2
- package/dist/types/src/components/DeckLayout/PlankControls.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/PlankError.d.ts +4 -3
- package/dist/types/src/components/DeckLayout/PlankError.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts +1 -5
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/SidebarButton.d.ts +8 -0
- package/dist/types/src/components/DeckLayout/SidebarButton.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/StatusBar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Toast.d.ts +2 -2
- package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Topbar.d.ts +3 -0
- package/dist/types/src/components/DeckLayout/Topbar.d.ts.map +1 -0
- package/dist/types/src/components/fragments.d.ts +4 -0
- package/dist/types/src/components/fragments.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +0 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +4 -0
- package/dist/types/src/events.d.ts.map +1 -0
- package/dist/types/src/hooks/useMainSize.d.ts +2 -2
- package/dist/types/src/index.d.ts +3 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/layout.d.ts +5 -19
- package/dist/types/src/layout.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +4 -4
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +7 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +130 -17
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +3 -2
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/layoutAppliesTopbar.d.ts +2 -0
- package/dist/types/src/util/layoutAppliesTopbar.d.ts.map +1 -0
- package/dist/types/src/util/useBreakpoints.d.ts +2 -0
- package/dist/types/src/util/useBreakpoints.d.ts.map +1 -0
- package/dist/types/src/util/useHoistStatusbar.d.ts +2 -0
- package/dist/types/src/util/useHoistStatusbar.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +32 -36
- package/src/DeckPlugin.ts +83 -0
- package/src/capabilities/app-graph-builder.ts +109 -0
- package/src/capabilities/capabilities.ts +18 -0
- package/src/capabilities/check-app-scheme.ts +44 -0
- package/src/capabilities/index.ts +17 -0
- package/src/capabilities/intent-resolver.ts +350 -0
- package/src/capabilities/react-root.tsx +48 -0
- package/src/capabilities/react-surface.tsx +31 -0
- package/src/capabilities/set-active.ts +43 -0
- package/src/capabilities/settings.ts +21 -0
- package/src/capabilities/state.ts +102 -0
- package/src/capabilities/tools.ts +61 -0
- package/src/capabilities/url-handler.ts +63 -0
- package/src/components/DeckLayout/ActiveNode.tsx +3 -4
- package/src/components/DeckLayout/Banner.tsx +37 -0
- package/src/components/DeckLayout/ComplementarySidebar.tsx +130 -56
- package/src/components/DeckLayout/ContentEmpty.tsx +9 -4
- package/src/components/DeckLayout/DeckLayout.tsx +116 -83
- package/src/components/DeckLayout/Fullscreen.tsx +3 -4
- package/src/components/DeckLayout/NodePlankHeading.tsx +66 -93
- package/src/components/DeckLayout/Plank.tsx +36 -43
- package/src/components/DeckLayout/PlankControls.tsx +12 -13
- package/src/components/DeckLayout/PlankError.tsx +6 -5
- package/src/components/DeckLayout/Sidebar.tsx +19 -26
- package/src/components/DeckLayout/SidebarButton.tsx +68 -0
- package/src/components/DeckLayout/StatusBar.tsx +6 -12
- package/src/components/DeckLayout/Toast.tsx +21 -8
- package/src/components/DeckLayout/Topbar.tsx +11 -0
- package/src/components/LayoutSettings.tsx +8 -8
- package/src/components/fragments.ts +14 -0
- package/src/components/index.ts +0 -2
- package/src/events.ts +11 -0
- package/src/hooks/useMainSize.ts +3 -3
- package/src/index.ts +3 -4
- package/src/layout.ts +43 -212
- package/src/meta.ts +3 -2
- package/src/translations.ts +11 -6
- package/src/types.ts +110 -34
- package/src/util/index.ts +3 -2
- package/src/util/layoutAppliesTopbar.ts +7 -0
- package/src/util/useBreakpoints.ts +11 -0
- package/src/util/useHoistStatusbar.ts +24 -0
- package/dist/lib/browser/chunk-GVOGPULO.mjs.map +0 -7
- package/dist/lib/browser/chunk-NIRHDTX4.mjs +0 -17
- package/dist/lib/browser/chunk-NIRHDTX4.mjs.map +0 -7
- package/dist/lib/browser/meta.mjs +0 -9
- package/dist/lib/browser/meta.mjs.map +0 -7
- package/dist/types/src/components/DeckContext.d.ts +0 -8
- package/dist/types/src/components/DeckContext.d.ts.map +0 -1
- package/dist/types/src/components/LayoutContext.d.ts +0 -5
- package/dist/types/src/components/LayoutContext.d.ts.map +0 -1
- package/dist/types/src/layout.test.d.ts +0 -2
- package/dist/types/src/layout.test.d.ts.map +0 -1
- package/dist/types/src/util/check-app-scheme.d.ts +0 -2
- package/dist/types/src/util/check-app-scheme.d.ts.map +0 -1
- package/dist/types/src/util/layout-parts.d.ts +0 -7
- package/dist/types/src/util/layout-parts.d.ts.map +0 -1
- package/src/DeckPlugin.tsx +0 -657
- package/src/components/DeckContext.ts +0 -14
- package/src/components/LayoutContext.ts +0 -12
- package/src/layout.test.ts +0 -380
- package/src/util/check-app-scheme.ts +0 -21
- package/src/util/layout-parts.ts +0 -12
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"check-app-scheme.d.ts","sourceRoot":"","sources":["../../../../src/util/check-app-scheme.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc,QAAS,MAAM,SAezC,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type LayoutMode, type LayoutPart } from '@dxos/app-framework';
|
|
2
|
-
/**
|
|
3
|
-
* If in solo mode and the part is the main part, open it in solo mode.
|
|
4
|
-
* From the dispatch POV we refer to both 'solo' and 'main' as 'main'.
|
|
5
|
-
*/
|
|
6
|
-
export declare const getEffectivePart: (partName: LayoutPart, layoutMode: LayoutMode) => LayoutPart;
|
|
7
|
-
//# sourceMappingURL=layout-parts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layout-parts.d.ts","sourceRoot":"","sources":["../../../../src/util/layout-parts.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,gBAAgB,aAAc,UAAU,cAAc,UAAU,KAAG,UACd,CAAC"}
|
package/src/DeckPlugin.tsx
DELETED
|
@@ -1,657 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { batch } from '@preact/signals-core';
|
|
6
|
-
import { setAutoFreeze } from 'immer';
|
|
7
|
-
import React, { type PropsWithChildren } from 'react';
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
filterPlugins,
|
|
11
|
-
type GraphProvides,
|
|
12
|
-
IntentAction,
|
|
13
|
-
type IntentData,
|
|
14
|
-
type IntentPluginProvides,
|
|
15
|
-
isLayoutAdjustment,
|
|
16
|
-
isLayoutMode,
|
|
17
|
-
isLayoutParts,
|
|
18
|
-
type Layout,
|
|
19
|
-
LayoutAction,
|
|
20
|
-
type LayoutEntry,
|
|
21
|
-
type LayoutMode,
|
|
22
|
-
type LayoutPart,
|
|
23
|
-
type LayoutParts,
|
|
24
|
-
NavigationAction,
|
|
25
|
-
openIds,
|
|
26
|
-
parseGraphPlugin,
|
|
27
|
-
parseIntentPlugin,
|
|
28
|
-
type Plugin,
|
|
29
|
-
type PluginDefinition,
|
|
30
|
-
resolvePlugin,
|
|
31
|
-
SLUG_PATH_SEPARATOR,
|
|
32
|
-
Toast as ToastSchema,
|
|
33
|
-
} from '@dxos/app-framework';
|
|
34
|
-
import { type UnsubscribeCallback } from '@dxos/async';
|
|
35
|
-
import { getTypename } from '@dxos/echo-schema';
|
|
36
|
-
import { scheduledEffect } from '@dxos/echo-signals/core';
|
|
37
|
-
import { create, isReactiveObject } from '@dxos/live-object';
|
|
38
|
-
import { LocalStorageStore } from '@dxos/local-storage';
|
|
39
|
-
import { log } from '@dxos/log';
|
|
40
|
-
import { type AttentionPluginProvides, parseAttentionPlugin } from '@dxos/plugin-attention';
|
|
41
|
-
import { createExtension, type Node } from '@dxos/plugin-graph';
|
|
42
|
-
import { ObservabilityAction } from '@dxos/plugin-observability/meta';
|
|
43
|
-
import { fullyQualifiedId } from '@dxos/react-client/echo';
|
|
44
|
-
import { translations as stackTranslations } from '@dxos/react-ui-stack';
|
|
45
|
-
|
|
46
|
-
import { DeckContext, type DeckContextType, DeckLayout, LayoutContext, LayoutSettings, NAV_ID } from './components';
|
|
47
|
-
import {
|
|
48
|
-
closeEntry,
|
|
49
|
-
incrementPlank,
|
|
50
|
-
mergeLayoutParts,
|
|
51
|
-
openEntry,
|
|
52
|
-
removePart,
|
|
53
|
-
soloPartToUri,
|
|
54
|
-
uriToSoloPart,
|
|
55
|
-
} from './layout';
|
|
56
|
-
import meta, { DECK_PLUGIN } from './meta';
|
|
57
|
-
import translations from './translations';
|
|
58
|
-
import {
|
|
59
|
-
type DeckPluginProvides,
|
|
60
|
-
type DeckSettingsProps,
|
|
61
|
-
type NewPlankPositioning,
|
|
62
|
-
type Overscroll,
|
|
63
|
-
type Panel,
|
|
64
|
-
parsePanelPlugin,
|
|
65
|
-
} from './types';
|
|
66
|
-
import { checkAppScheme, getEffectivePart } from './util';
|
|
67
|
-
|
|
68
|
-
const isSocket = !!(globalThis as any).__args;
|
|
69
|
-
|
|
70
|
-
// TODO(mjamesderocher): Can we get this directly from Socket?
|
|
71
|
-
const appScheme = 'composer://';
|
|
72
|
-
|
|
73
|
-
// NOTE(Zan): When producing values with immer, we shouldn't auto-freeze them because
|
|
74
|
-
// our signal implementation needs to add some hidden properties to the produced values.
|
|
75
|
-
// TODO(Zan): Move this to a more global location if we use immer more broadly.
|
|
76
|
-
setAutoFreeze(false);
|
|
77
|
-
|
|
78
|
-
//
|
|
79
|
-
// Intents
|
|
80
|
-
//
|
|
81
|
-
const DECK_ACTION = 'dxos.org/plugin/deck';
|
|
82
|
-
|
|
83
|
-
export enum DeckAction {
|
|
84
|
-
UPDATE_PLANK_SIZE = `${DECK_ACTION}/update-plank-size`,
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export namespace DeckAction {
|
|
88
|
-
export type UpdatePlankSize = IntentData<{ id: string; size: number }>;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export const DeckPlugin = ({
|
|
92
|
-
observability,
|
|
93
|
-
}: {
|
|
94
|
-
observability?: boolean;
|
|
95
|
-
} = {}): PluginDefinition<DeckPluginProvides> => {
|
|
96
|
-
let graphPlugin: Plugin<GraphProvides> | undefined;
|
|
97
|
-
let intentPlugin: Plugin<IntentPluginProvides> | undefined;
|
|
98
|
-
let attentionPlugin: Plugin<AttentionPluginProvides> | undefined;
|
|
99
|
-
const unsubscriptionCallbacks = [] as (UnsubscribeCallback | undefined)[];
|
|
100
|
-
let currentUndoId: string | undefined;
|
|
101
|
-
let handleNavigation: () => Promise<void> | undefined;
|
|
102
|
-
const panels: Panel[] = [];
|
|
103
|
-
|
|
104
|
-
const settings = new LocalStorageStore<DeckSettingsProps>('dxos.org/settings/layout', {
|
|
105
|
-
showHints: false,
|
|
106
|
-
customSlots: false,
|
|
107
|
-
flatDeck: false,
|
|
108
|
-
enableNativeRedirect: false,
|
|
109
|
-
disableDeck: false,
|
|
110
|
-
newPlankPositioning: 'start',
|
|
111
|
-
overscroll: 'centering',
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
const layout = new LocalStorageStore<Layout>('dxos.org/settings/layout', {
|
|
115
|
-
layoutMode: 'solo',
|
|
116
|
-
sidebarOpen: true,
|
|
117
|
-
complementarySidebarOpen: false,
|
|
118
|
-
dialogContent: null,
|
|
119
|
-
dialogOpen: false,
|
|
120
|
-
dialogBlockAlign: undefined,
|
|
121
|
-
dialogType: undefined,
|
|
122
|
-
popoverContent: null,
|
|
123
|
-
popoverAnchorId: undefined,
|
|
124
|
-
popoverOpen: false,
|
|
125
|
-
toasts: [],
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
const deck = new LocalStorageStore<DeckContextType>('dxos.org/settings/deck', {
|
|
129
|
-
plankSizing: {},
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
// TODO(wittjosiah): This active state is not a generic navigation state but quite deck specific.
|
|
133
|
-
// It is also closely tied to the layout mode state (which also seems quite deck specific).
|
|
134
|
-
// The layout and navigation interfaces need to be revisited and cleaned up.
|
|
135
|
-
// Doing this cleanup should also help simplify some of the convoluted logic for managing it.
|
|
136
|
-
const location = new LocalStorageStore<{ active: LayoutParts; closed: string[] }>('dxos.org/state/layout', {
|
|
137
|
-
active: { sidebar: [{ id: NAV_ID }] },
|
|
138
|
-
closed: [],
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
// TODO(Zan): Cap depth!
|
|
142
|
-
const layoutModeHistory = create({ values: [] as LayoutMode[] });
|
|
143
|
-
|
|
144
|
-
const handleSetLayout = ({
|
|
145
|
-
element,
|
|
146
|
-
state,
|
|
147
|
-
component,
|
|
148
|
-
subject,
|
|
149
|
-
anchorId,
|
|
150
|
-
dialogBlockAlign,
|
|
151
|
-
dialogType,
|
|
152
|
-
}: LayoutAction.SetLayout) => {
|
|
153
|
-
switch (element) {
|
|
154
|
-
case 'sidebar': {
|
|
155
|
-
layout.values.sidebarOpen = state ?? !layout.values.sidebarOpen;
|
|
156
|
-
return { data: true };
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
case 'complementary': {
|
|
160
|
-
layout.values.complementarySidebarOpen = !!state;
|
|
161
|
-
// TODO(thure): Hoist content into the c11y sidebar of Deck.
|
|
162
|
-
// layout.values.complementarySidebarContent = component || subject ? { component, subject } : null;
|
|
163
|
-
return { data: true };
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
case 'dialog': {
|
|
167
|
-
layout.values.dialogOpen = state ?? Boolean(component);
|
|
168
|
-
layout.values.dialogContent = component ? { component, subject } : null;
|
|
169
|
-
layout.values.dialogBlockAlign = dialogBlockAlign ?? 'center';
|
|
170
|
-
layout.values.dialogType = dialogType;
|
|
171
|
-
return { data: true };
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
case 'popover': {
|
|
175
|
-
layout.values.popoverOpen = state ?? Boolean(component);
|
|
176
|
-
layout.values.popoverContent = component ? { component, subject } : null;
|
|
177
|
-
layout.values.popoverAnchorId = anchorId;
|
|
178
|
-
return { data: true };
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
case 'toast': {
|
|
182
|
-
if (ToastSchema.safeParse(subject).success) {
|
|
183
|
-
layout.values.toasts = [...layout.values.toasts, subject];
|
|
184
|
-
return { data: true };
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Update the active state and ensure that attention is on an active element.
|
|
192
|
-
*/
|
|
193
|
-
const handleSetLocation = (next: LayoutParts) => {
|
|
194
|
-
const part = layout.values.layoutMode === 'solo' ? 'solo' : 'main';
|
|
195
|
-
const ids = openIds(next, [part]);
|
|
196
|
-
|
|
197
|
-
if (attentionPlugin) {
|
|
198
|
-
const attended = attentionPlugin.provides.attention.attended;
|
|
199
|
-
const [attendedId] = Array.from(attended);
|
|
200
|
-
const isAttendedAvailable = !!attendedId && ids.includes(attendedId);
|
|
201
|
-
if (!isAttendedAvailable) {
|
|
202
|
-
const currentIds = location.values.active[part]?.map(({ id }) => id) ?? [];
|
|
203
|
-
const attendedIndex = currentIds.indexOf(attendedId);
|
|
204
|
-
// If outside of bounds, focus on the first/last plank, otherwise focus on the new plank in the same position.
|
|
205
|
-
const index = attendedIndex === -1 ? 0 : attendedIndex >= ids.length ? ids.length - 1 : attendedIndex;
|
|
206
|
-
const nextAttended = next[part]?.[index].id;
|
|
207
|
-
void intentPlugin?.provides.intent.dispatch({
|
|
208
|
-
action: LayoutAction.SCROLL_INTO_VIEW,
|
|
209
|
-
data: { id: nextAttended },
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
const current = openIds(location.values.active, [part]);
|
|
215
|
-
const removed = current.filter((id) => !ids.includes(id));
|
|
216
|
-
const closed = Array.from(new Set([...location.values.closed.filter((id) => !ids.includes(id)), ...removed]));
|
|
217
|
-
|
|
218
|
-
location.values.closed = closed;
|
|
219
|
-
location.values.active = next;
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
return {
|
|
223
|
-
meta,
|
|
224
|
-
ready: async (plugins) => {
|
|
225
|
-
intentPlugin = resolvePlugin(plugins, parseIntentPlugin);
|
|
226
|
-
graphPlugin = resolvePlugin(plugins, parseGraphPlugin);
|
|
227
|
-
attentionPlugin = resolvePlugin(plugins, parseAttentionPlugin);
|
|
228
|
-
|
|
229
|
-
layout
|
|
230
|
-
.prop({ key: 'layoutMode', type: LocalStorageStore.enum<LayoutMode>() })
|
|
231
|
-
.prop({ key: 'sidebarOpen', type: LocalStorageStore.bool() })
|
|
232
|
-
.prop({ key: 'complementarySidebarOpen', type: LocalStorageStore.bool() });
|
|
233
|
-
|
|
234
|
-
deck.prop({ key: 'plankSizing', type: LocalStorageStore.json<Record<string, number>>() });
|
|
235
|
-
|
|
236
|
-
location
|
|
237
|
-
.prop({ key: 'active', type: LocalStorageStore.json<LayoutParts>() })
|
|
238
|
-
.prop({ key: 'closed', type: LocalStorageStore.json<string[]>() });
|
|
239
|
-
|
|
240
|
-
panels.push(
|
|
241
|
-
...filterPlugins(plugins, parsePanelPlugin).flatMap((plugin) => plugin.provides.complementary.panels),
|
|
242
|
-
);
|
|
243
|
-
|
|
244
|
-
settings
|
|
245
|
-
.prop({ key: 'showHints', type: LocalStorageStore.bool() })
|
|
246
|
-
.prop({ key: 'customSlots', type: LocalStorageStore.bool() })
|
|
247
|
-
.prop({ key: 'flatDeck', type: LocalStorageStore.bool() })
|
|
248
|
-
.prop({ key: 'enableNativeRedirect', type: LocalStorageStore.bool() })
|
|
249
|
-
.prop({ key: 'disableDeck', type: LocalStorageStore.bool() }) // Deprecated.
|
|
250
|
-
.prop({ key: 'newPlankPositioning', type: LocalStorageStore.enum<NewPlankPositioning>() })
|
|
251
|
-
.prop({ key: 'overscroll', type: LocalStorageStore.enum<Overscroll>() });
|
|
252
|
-
|
|
253
|
-
if (!isSocket && settings.values.enableNativeRedirect) {
|
|
254
|
-
checkAppScheme(appScheme);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
handleNavigation = async () => {
|
|
258
|
-
const pathname = window.location.pathname;
|
|
259
|
-
if (pathname === '/reset') {
|
|
260
|
-
handleSetLocation({ sidebar: [{ id: NAV_ID }] });
|
|
261
|
-
location.values.closed = [];
|
|
262
|
-
layout.values.layoutMode = 'solo';
|
|
263
|
-
window.location.pathname = '/';
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
const startingLayout = removePart(location.values.active, 'solo');
|
|
268
|
-
const layoutFromUri = uriToSoloPart(pathname);
|
|
269
|
-
if (!layoutFromUri) {
|
|
270
|
-
handleSetLocation(startingLayout);
|
|
271
|
-
layout.values.layoutMode = 'deck';
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
handleSetLocation(mergeLayoutParts(layoutFromUri, startingLayout));
|
|
276
|
-
layout.values.layoutMode = 'solo';
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
await handleNavigation();
|
|
280
|
-
window.addEventListener('popstate', handleNavigation);
|
|
281
|
-
|
|
282
|
-
unsubscriptionCallbacks.push(
|
|
283
|
-
scheduledEffect(
|
|
284
|
-
() => ({ selectedPath: soloPartToUri(location.values.active) }),
|
|
285
|
-
({ selectedPath }) => {
|
|
286
|
-
// TODO(thure): In some browsers, this only preserves the most recent state change, even though this is not `history.replace`…
|
|
287
|
-
history.pushState(null, '', `/${selectedPath}${window.location.search}`);
|
|
288
|
-
},
|
|
289
|
-
),
|
|
290
|
-
);
|
|
291
|
-
|
|
292
|
-
layoutModeHistory.values.push(`${layout.values.layoutMode}`);
|
|
293
|
-
},
|
|
294
|
-
unload: async () => {
|
|
295
|
-
layout.close();
|
|
296
|
-
location.close();
|
|
297
|
-
unsubscriptionCallbacks.forEach((unsubscribe) => unsubscribe?.());
|
|
298
|
-
window.removeEventListener('popstate', handleNavigation);
|
|
299
|
-
},
|
|
300
|
-
provides: {
|
|
301
|
-
settings: settings.values,
|
|
302
|
-
layout: layout.values,
|
|
303
|
-
location: location.values,
|
|
304
|
-
translations: [...translations, ...stackTranslations],
|
|
305
|
-
graph: {
|
|
306
|
-
builder: () => {
|
|
307
|
-
// TODO(burdon): Root menu isn't visible so nothing bound.
|
|
308
|
-
return createExtension({
|
|
309
|
-
id: DECK_PLUGIN,
|
|
310
|
-
// NOTE(Zan): This is currently disabled.
|
|
311
|
-
// TODO(Zan): Fullscreen needs to know the active node and provide that to the layout part.
|
|
312
|
-
filter: (node): node is Node<null> => false,
|
|
313
|
-
actions: () => [
|
|
314
|
-
{
|
|
315
|
-
id: `${LayoutAction.SET_LAYOUT_MODE}/fullscreen`,
|
|
316
|
-
data: async () => {
|
|
317
|
-
await intentPlugin?.provides.intent.dispatch({
|
|
318
|
-
plugin: DECK_PLUGIN,
|
|
319
|
-
action: LayoutAction.SET_LAYOUT_MODE,
|
|
320
|
-
data: { layoutMode: 'fullscreen' },
|
|
321
|
-
});
|
|
322
|
-
},
|
|
323
|
-
properties: {
|
|
324
|
-
label: ['toggle fullscreen label', { ns: DECK_PLUGIN }],
|
|
325
|
-
icon: 'ph--arrows-out--regular',
|
|
326
|
-
keyBinding: {
|
|
327
|
-
macos: 'ctrl+meta+f',
|
|
328
|
-
windows: 'shift+ctrl+f',
|
|
329
|
-
},
|
|
330
|
-
},
|
|
331
|
-
},
|
|
332
|
-
],
|
|
333
|
-
});
|
|
334
|
-
},
|
|
335
|
-
},
|
|
336
|
-
context: (props: PropsWithChildren) => (
|
|
337
|
-
<LayoutContext.Provider value={layout.values}>
|
|
338
|
-
<DeckContext.Provider value={deck.values}>{props.children}</DeckContext.Provider>
|
|
339
|
-
</LayoutContext.Provider>
|
|
340
|
-
),
|
|
341
|
-
root: () => {
|
|
342
|
-
return (
|
|
343
|
-
<DeckLayout
|
|
344
|
-
layoutParts={location.values.active}
|
|
345
|
-
showHints={settings.values.showHints}
|
|
346
|
-
overscroll={settings.values.overscroll}
|
|
347
|
-
toasts={layout.values.toasts}
|
|
348
|
-
panels={panels}
|
|
349
|
-
onDismissToast={(id) => {
|
|
350
|
-
const index = layout.values.toasts.findIndex((toast) => toast.id === id);
|
|
351
|
-
if (index !== -1) {
|
|
352
|
-
// Allow time for the toast to animate out.
|
|
353
|
-
// TODO(burdon): Factor out and unregister timeout.
|
|
354
|
-
setTimeout(() => {
|
|
355
|
-
if (layout.values.toasts[index].id === currentUndoId) {
|
|
356
|
-
currentUndoId = undefined;
|
|
357
|
-
}
|
|
358
|
-
layout.values.toasts.splice(index, 1);
|
|
359
|
-
}, 1_000);
|
|
360
|
-
}
|
|
361
|
-
}}
|
|
362
|
-
/>
|
|
363
|
-
);
|
|
364
|
-
},
|
|
365
|
-
surface: {
|
|
366
|
-
component: ({ data, role }) => {
|
|
367
|
-
switch (role) {
|
|
368
|
-
case 'settings':
|
|
369
|
-
return data.plugin === meta.id ? <LayoutSettings settings={settings.values} /> : null;
|
|
370
|
-
}
|
|
371
|
-
return null;
|
|
372
|
-
},
|
|
373
|
-
},
|
|
374
|
-
intent: {
|
|
375
|
-
resolver: (intent) => {
|
|
376
|
-
switch (intent.action) {
|
|
377
|
-
case LayoutAction.SET_LAYOUT: {
|
|
378
|
-
return intent.data && handleSetLayout(intent.data as LayoutAction.SetLayout);
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
case LayoutAction.SET_LAYOUT_MODE: {
|
|
382
|
-
const setMode = (mode: LayoutMode) => {
|
|
383
|
-
const main = openIds(location.values.active, ['main']);
|
|
384
|
-
const solo = openIds(location.values.active, ['solo']);
|
|
385
|
-
const current = layout.values.layoutMode === 'solo' ? solo : main;
|
|
386
|
-
// When un-soloing, the solo entry is added to the deck.
|
|
387
|
-
const next = mode === 'solo' ? solo : [...main, ...solo];
|
|
388
|
-
const removed = current.filter((id) => !next.includes(id));
|
|
389
|
-
const closed = Array.from(
|
|
390
|
-
new Set([...location.values.closed.filter((id) => !next.includes(id)), ...removed]),
|
|
391
|
-
);
|
|
392
|
-
|
|
393
|
-
location.values.closed = closed;
|
|
394
|
-
layout.values.layoutMode = mode;
|
|
395
|
-
};
|
|
396
|
-
|
|
397
|
-
// TODO(wittjosiah): Update closed state.
|
|
398
|
-
return batch(() => {
|
|
399
|
-
if (!intent.data) {
|
|
400
|
-
return;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
if (intent.data?.revert) {
|
|
404
|
-
setMode(layoutModeHistory.values.pop() ?? 'solo');
|
|
405
|
-
return { data: true };
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
if (isLayoutMode(intent?.data?.layoutMode)) {
|
|
409
|
-
layoutModeHistory.values.push(layout.values.layoutMode);
|
|
410
|
-
setMode(intent.data.layoutMode);
|
|
411
|
-
} else {
|
|
412
|
-
log.warn('Invalid layout mode', intent?.data?.layoutMode);
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
return { data: true };
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
case LayoutAction.SCROLL_INTO_VIEW: {
|
|
420
|
-
layout.values.scrollIntoView = intent.data?.id ?? undefined;
|
|
421
|
-
return { data: true };
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
case DeckAction.UPDATE_PLANK_SIZE: {
|
|
425
|
-
const { id, size } = intent.data as DeckAction.UpdatePlankSize;
|
|
426
|
-
deck.values.plankSizing[id] = size;
|
|
427
|
-
return { data: true };
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
case IntentAction.SHOW_UNDO: {
|
|
431
|
-
// TODO(wittjosiah): Support undoing further back than the last action.
|
|
432
|
-
if (currentUndoId) {
|
|
433
|
-
layout.values.toasts = layout.values.toasts.filter((toast) => toast.id !== currentUndoId);
|
|
434
|
-
}
|
|
435
|
-
currentUndoId = `${IntentAction.SHOW_UNDO}-${Date.now()}`;
|
|
436
|
-
const title =
|
|
437
|
-
// TODO(wittjosiah): How to handle chains better?
|
|
438
|
-
intent.data?.results?.[0]?.result?.undoable?.message ??
|
|
439
|
-
translations[0]['en-US']['dxos.org/plugin/deck']['undo available label'];
|
|
440
|
-
layout.values.toasts = [
|
|
441
|
-
...layout.values.toasts,
|
|
442
|
-
{
|
|
443
|
-
id: currentUndoId,
|
|
444
|
-
title,
|
|
445
|
-
duration: 10_000,
|
|
446
|
-
actionLabel: translations[0]['en-US']['dxos.org/plugin/deck']['undo action label'],
|
|
447
|
-
actionAlt: translations[0]['en-US']['dxos.org/plugin/deck']['undo action alt'],
|
|
448
|
-
closeLabel: translations[0]['en-US']['dxos.org/plugin/deck']['undo close label'],
|
|
449
|
-
onAction: () => intentPlugin?.provides.intent.undo?.(),
|
|
450
|
-
},
|
|
451
|
-
];
|
|
452
|
-
return { data: true };
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
case NavigationAction.OPEN: {
|
|
456
|
-
const previouslyOpenIds = new Set<string>(openIds(location.values.active));
|
|
457
|
-
const layoutMode = layout.values.layoutMode;
|
|
458
|
-
batch(() => {
|
|
459
|
-
if (!intent.data || !intent.data?.activeParts) {
|
|
460
|
-
return;
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
const processLayoutEntry = (partName: string, entryString: string, currentLayout: any) => {
|
|
464
|
-
// TODO(burdon): Option to toggle?
|
|
465
|
-
const toggle = false;
|
|
466
|
-
const [id, path] = entryString.split(SLUG_PATH_SEPARATOR);
|
|
467
|
-
const layoutEntry: LayoutEntry = { id, ...(path ? { path } : {}) };
|
|
468
|
-
const effectivePart = getEffectivePart(partName as LayoutPart, layoutMode);
|
|
469
|
-
if (
|
|
470
|
-
toggle &&
|
|
471
|
-
layoutMode === 'deck' &&
|
|
472
|
-
effectivePart === 'main' &&
|
|
473
|
-
currentLayout[effectivePart]?.some((entry: LayoutEntry) => entry.id === id) &&
|
|
474
|
-
!intent.data?.noToggle
|
|
475
|
-
) {
|
|
476
|
-
// If we're in deck mode and the main part is already open, toggle it closed.
|
|
477
|
-
return closeEntry(currentLayout, { part: effectivePart as LayoutPart, entryId: id });
|
|
478
|
-
} else {
|
|
479
|
-
return openEntry(currentLayout, effectivePart, layoutEntry, {
|
|
480
|
-
positioning: settings.values.newPlankPositioning,
|
|
481
|
-
});
|
|
482
|
-
}
|
|
483
|
-
};
|
|
484
|
-
|
|
485
|
-
let newLayout = location.values.active;
|
|
486
|
-
Object.entries(intent.data.activeParts).forEach(([partName, layoutEntries]) => {
|
|
487
|
-
if (Array.isArray(layoutEntries)) {
|
|
488
|
-
layoutEntries.forEach((activePartEntry: string) => {
|
|
489
|
-
newLayout = processLayoutEntry(partName, activePartEntry, newLayout);
|
|
490
|
-
});
|
|
491
|
-
} else if (typeof layoutEntries === 'string') {
|
|
492
|
-
// Legacy single string entry.
|
|
493
|
-
newLayout = processLayoutEntry(partName, layoutEntries, newLayout);
|
|
494
|
-
}
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
handleSetLocation(newLayout);
|
|
498
|
-
});
|
|
499
|
-
|
|
500
|
-
const ids = openIds(location.values.active);
|
|
501
|
-
const newlyOpen = ids.filter((i) => !previouslyOpenIds.has(i));
|
|
502
|
-
|
|
503
|
-
return {
|
|
504
|
-
data: { ids },
|
|
505
|
-
intents: [
|
|
506
|
-
newlyOpen.length > 0
|
|
507
|
-
? [
|
|
508
|
-
{
|
|
509
|
-
action: LayoutAction.SCROLL_INTO_VIEW,
|
|
510
|
-
data: { id: newlyOpen[0] },
|
|
511
|
-
},
|
|
512
|
-
]
|
|
513
|
-
: [],
|
|
514
|
-
intent.data?.object
|
|
515
|
-
? [
|
|
516
|
-
{
|
|
517
|
-
action: NavigationAction.EXPOSE,
|
|
518
|
-
data: { id: fullyQualifiedId(intent.data.object) },
|
|
519
|
-
},
|
|
520
|
-
]
|
|
521
|
-
: [],
|
|
522
|
-
observability
|
|
523
|
-
? newlyOpen.map((id) => {
|
|
524
|
-
const active = graphPlugin?.provides.graph.findNode(id)?.data;
|
|
525
|
-
const typename = isReactiveObject(active) ? getTypename(active) : undefined;
|
|
526
|
-
return {
|
|
527
|
-
action: ObservabilityAction.SEND_EVENT,
|
|
528
|
-
data: {
|
|
529
|
-
name: 'navigation.activate',
|
|
530
|
-
properties: {
|
|
531
|
-
id,
|
|
532
|
-
typename,
|
|
533
|
-
},
|
|
534
|
-
},
|
|
535
|
-
};
|
|
536
|
-
})
|
|
537
|
-
: [],
|
|
538
|
-
],
|
|
539
|
-
};
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
case NavigationAction.ADD_TO_ACTIVE: {
|
|
543
|
-
const data = intent.data as NavigationAction.AddToActive;
|
|
544
|
-
const layoutEntry = { id: data.id };
|
|
545
|
-
const effectivePart = getEffectivePart(data.part, layout.values.layoutMode);
|
|
546
|
-
|
|
547
|
-
handleSetLocation(
|
|
548
|
-
openEntry(location.values.active, effectivePart, layoutEntry, {
|
|
549
|
-
positioning: data.positioning ?? settings.values.newPlankPositioning,
|
|
550
|
-
pivotId: data.pivotId,
|
|
551
|
-
}),
|
|
552
|
-
);
|
|
553
|
-
|
|
554
|
-
const intents = [];
|
|
555
|
-
if (data.scrollIntoView && layout.values.layoutMode === 'deck') {
|
|
556
|
-
intents.push([
|
|
557
|
-
{
|
|
558
|
-
action: LayoutAction.SCROLL_INTO_VIEW,
|
|
559
|
-
data: { id: data.id },
|
|
560
|
-
},
|
|
561
|
-
]);
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
return { data: true, intents };
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
case NavigationAction.CLOSE: {
|
|
568
|
-
return batch(() => {
|
|
569
|
-
if (!intent.data) {
|
|
570
|
-
return;
|
|
571
|
-
}
|
|
572
|
-
let newLayout = location.values.active;
|
|
573
|
-
const layoutMode = layout.values.layoutMode;
|
|
574
|
-
const intentParts = intent.data.activeParts;
|
|
575
|
-
Object.keys(intentParts).forEach((partName: string) => {
|
|
576
|
-
const effectivePart = getEffectivePart(partName as LayoutPart, layoutMode);
|
|
577
|
-
const ids = intentParts[partName];
|
|
578
|
-
if (Array.isArray(ids)) {
|
|
579
|
-
ids.forEach((id: string) => {
|
|
580
|
-
newLayout = closeEntry(newLayout, { part: effectivePart, entryId: id });
|
|
581
|
-
});
|
|
582
|
-
} else {
|
|
583
|
-
// Legacy single string entry
|
|
584
|
-
newLayout = closeEntry(newLayout, { part: effectivePart, entryId: ids });
|
|
585
|
-
}
|
|
586
|
-
});
|
|
587
|
-
|
|
588
|
-
handleSetLocation(newLayout);
|
|
589
|
-
return { data: true };
|
|
590
|
-
});
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
// TODO(wittjosiah): Factor out.
|
|
594
|
-
case NavigationAction.SET: {
|
|
595
|
-
return batch(() => {
|
|
596
|
-
if (isLayoutParts(intent.data?.activeParts)) {
|
|
597
|
-
handleSetLocation(intent.data!.activeParts);
|
|
598
|
-
}
|
|
599
|
-
return { data: true };
|
|
600
|
-
});
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
case NavigationAction.ADJUST: {
|
|
604
|
-
return batch(() => {
|
|
605
|
-
if (isLayoutAdjustment(intent.data)) {
|
|
606
|
-
const adjustment = intent.data;
|
|
607
|
-
if (adjustment.type === 'increment-end' || adjustment.type === 'increment-start') {
|
|
608
|
-
handleSetLocation(
|
|
609
|
-
incrementPlank(location.values.active, {
|
|
610
|
-
type: adjustment.type,
|
|
611
|
-
layoutCoordinate: adjustment.layoutCoordinate,
|
|
612
|
-
}),
|
|
613
|
-
);
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
if (adjustment.type === 'solo') {
|
|
617
|
-
const entryId = adjustment.layoutCoordinate.entryId;
|
|
618
|
-
if (layout.values.layoutMode !== 'solo') {
|
|
619
|
-
// Solo the entry.
|
|
620
|
-
return {
|
|
621
|
-
data: true,
|
|
622
|
-
intents: [
|
|
623
|
-
// NOTE: The order of these is important.
|
|
624
|
-
[
|
|
625
|
-
{ action: NavigationAction.OPEN, data: { activeParts: { solo: [entryId] } } },
|
|
626
|
-
{ action: LayoutAction.SET_LAYOUT_MODE, data: { layoutMode: 'solo' } },
|
|
627
|
-
],
|
|
628
|
-
],
|
|
629
|
-
};
|
|
630
|
-
} else {
|
|
631
|
-
// Un-solo the current entry.
|
|
632
|
-
return {
|
|
633
|
-
data: true,
|
|
634
|
-
intents: [
|
|
635
|
-
// NOTE: The order of these is important.
|
|
636
|
-
[
|
|
637
|
-
{ action: LayoutAction.SET_LAYOUT_MODE, data: { layoutMode: 'deck' } },
|
|
638
|
-
{ action: NavigationAction.CLOSE, data: { activeParts: { solo: [entryId] } } },
|
|
639
|
-
{
|
|
640
|
-
action: NavigationAction.OPEN,
|
|
641
|
-
data: { noToggle: true, activeParts: { main: [entryId] } },
|
|
642
|
-
},
|
|
643
|
-
{ action: LayoutAction.SCROLL_INTO_VIEW, data: { id: entryId } },
|
|
644
|
-
],
|
|
645
|
-
],
|
|
646
|
-
};
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
},
|
|
654
|
-
},
|
|
655
|
-
},
|
|
656
|
-
};
|
|
657
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Context, createContext, useContext } from 'react';
|
|
6
|
-
|
|
7
|
-
import { raise } from '@dxos/debug';
|
|
8
|
-
|
|
9
|
-
export type PlankSizing = Record<string, number>;
|
|
10
|
-
export type DeckContextType = { plankSizing: PlankSizing };
|
|
11
|
-
|
|
12
|
-
export const DeckContext: Context<DeckContextType | null> = createContext<DeckContextType | null>(null);
|
|
13
|
-
|
|
14
|
-
export const useDeckContext = (): DeckContextType => useContext(DeckContext) ?? raise(new Error('Missing DeckContext'));
|