@dxos/plugin-deck 0.7.4 → 0.7.5-labs.5f04cf6
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-67VRUD5K.mjs +121 -0
- package/dist/lib/browser/app-graph-builder-67VRUD5K.mjs.map +7 -0
- package/dist/lib/browser/check-app-scheme-GEX6W2R5.mjs +33 -0
- package/dist/lib/browser/check-app-scheme-GEX6W2R5.mjs.map +7 -0
- package/dist/lib/browser/chunk-2PJNBVCY.mjs +39 -0
- package/dist/lib/browser/chunk-2PJNBVCY.mjs.map +7 -0
- package/dist/lib/browser/chunk-4C2AFTET.mjs +186 -0
- package/dist/lib/browser/chunk-4C2AFTET.mjs.map +7 -0
- package/dist/lib/browser/chunk-5VFDMW5M.mjs +17 -0
- package/dist/lib/browser/chunk-5VFDMW5M.mjs.map +7 -0
- package/dist/lib/browser/{chunk-GVOGPULO.mjs → chunk-JQJ5UWVB.mjs} +3 -3
- package/dist/lib/browser/chunk-JQJ5UWVB.mjs.map +7 -0
- package/dist/lib/browser/chunk-KY5WXIXY.mjs +44 -0
- package/dist/lib/browser/chunk-KY5WXIXY.mjs.map +7 -0
- package/dist/lib/browser/chunk-WUMAJGVA.mjs +1052 -0
- package/dist/lib/browser/chunk-WUMAJGVA.mjs.map +7 -0
- package/dist/lib/browser/deck-PLCSKPGL.mjs +26 -0
- package/dist/lib/browser/deck-PLCSKPGL.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +142 -1803
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-FVOQSTBX.mjs +152 -0
- package/dist/lib/browser/intent-resolver-FVOQSTBX.mjs.map +7 -0
- package/dist/lib/browser/intent-resolver-K7GW4A2I.mjs +249 -0
- package/dist/lib/browser/intent-resolver-K7GW4A2I.mjs.map +7 -0
- package/dist/lib/browser/location-AIO6V3MK.mjs +35 -0
- package/dist/lib/browser/location-AIO6V3MK.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-context-G6PDXUI5.mjs +32 -0
- package/dist/lib/browser/react-context-G6PDXUI5.mjs.map +7 -0
- package/dist/lib/browser/react-root-AWYSGU4Q.mjs +50 -0
- package/dist/lib/browser/react-root-AWYSGU4Q.mjs.map +7 -0
- package/dist/lib/browser/react-surface-CLUABFNX.mjs +28 -0
- package/dist/lib/browser/react-surface-CLUABFNX.mjs.map +7 -0
- package/dist/lib/browser/settings-FNWW6WIJ.mjs +29 -0
- package/dist/lib/browser/settings-FNWW6WIJ.mjs.map +7 -0
- package/dist/lib/browser/state-7I5BD7SE.mjs +34 -0
- package/dist/lib/browser/state-7I5BD7SE.mjs.map +7 -0
- package/dist/lib/browser/tools-4XY7KFQF.mjs +46 -0
- package/dist/lib/browser/tools-4XY7KFQF.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +10 -5
- package/dist/lib/browser/url-handler-JRAQRY73.mjs +76 -0
- package/dist/lib/browser/url-handler-JRAQRY73.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/capabilities.d.ts +13 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +5 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/layout/app-graph-builder.d.ts +181 -0
- package/dist/types/src/capabilities/layout/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/layout/deck.d.ts +4 -0
- package/dist/types/src/capabilities/layout/deck.d.ts.map +1 -0
- package/dist/types/src/capabilities/layout/index.d.ts +229 -0
- package/dist/types/src/capabilities/layout/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/layout/intent-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/layout/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/layout/react-context.d.ts +8 -0
- package/dist/types/src/capabilities/layout/react-context.d.ts.map +1 -0
- package/dist/types/src/capabilities/layout/react-root.d.ts +7 -0
- package/dist/types/src/capabilities/layout/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/layout/state.d.ts +42 -0
- package/dist/types/src/capabilities/layout/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation/check-app-scheme.d.ts +4 -0
- package/dist/types/src/capabilities/navigation/check-app-scheme.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation/index.d.ts +6 -0
- package/dist/types/src/capabilities/navigation/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation/intent-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/navigation/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation/location.d.ts +4 -0
- package/dist/types/src/capabilities/navigation/location.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation/set-location.d.ts +10 -0
- package/dist/types/src/capabilities/navigation/set-location.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation/tools.d.ts +9 -0
- package/dist/types/src/capabilities/navigation/tools.d.ts.map +1 -0
- package/dist/types/src/capabilities/navigation/url-handler.d.ts +4 -0
- package/dist/types/src/capabilities/navigation/url-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +3 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/react-surface.d.ts +4 -0
- package/dist/types/src/capabilities/settings/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +4 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/components/DeckContext.d.ts +3 -0
- package/dist/types/src/components/DeckContext.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.map +1 -1
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Plank.d.ts +1 -1
- 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/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 +6 -0
- package/dist/types/src/components/DeckLayout/SidebarButton.d.ts.map +1 -0
- 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 +2 -0
- package/dist/types/src/components/fragments.d.ts.map +1 -0
- package/dist/types/src/events.d.ts +4 -0
- package/dist/types/src/events.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +3 -4
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +5 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +25 -17
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -1
- package/dist/types/src/util/index.d.ts.map +1 -1
- 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 +31 -35
- package/src/DeckPlugin.ts +129 -0
- package/src/capabilities/capabilities.ts +17 -0
- package/src/capabilities/index.ts +8 -0
- package/src/capabilities/layout/app-graph-builder.ts +101 -0
- package/src/capabilities/layout/deck.ts +25 -0
- package/src/capabilities/layout/index.ts +12 -0
- package/src/capabilities/layout/intent-resolver.ts +128 -0
- package/src/capabilities/layout/react-context.tsx +26 -0
- package/src/capabilities/layout/react-root.tsx +52 -0
- package/src/capabilities/layout/state.ts +32 -0
- package/src/capabilities/navigation/check-app-scheme.ts +44 -0
- package/src/capabilities/navigation/index.ts +11 -0
- package/src/capabilities/navigation/intent-resolver.ts +216 -0
- package/src/capabilities/navigation/location.ts +28 -0
- package/src/capabilities/navigation/set-location.ts +38 -0
- package/src/capabilities/navigation/tools.ts +57 -0
- package/src/capabilities/navigation/url-handler.ts +67 -0
- package/src/capabilities/settings/index.ts +8 -0
- package/src/capabilities/settings/react-surface.tsx +23 -0
- package/src/capabilities/settings/settings.ts +22 -0
- package/src/components/DeckContext.ts +6 -1
- package/src/components/DeckLayout/ActiveNode.tsx +1 -1
- package/src/components/DeckLayout/Banner.tsx +37 -0
- package/src/components/DeckLayout/ComplementarySidebar.tsx +76 -53
- package/src/components/DeckLayout/ContentEmpty.tsx +10 -2
- package/src/components/DeckLayout/DeckLayout.tsx +31 -40
- package/src/components/DeckLayout/Fullscreen.tsx +1 -1
- package/src/components/DeckLayout/NodePlankHeading.tsx +30 -49
- package/src/components/DeckLayout/Plank.tsx +13 -11
- package/src/components/DeckLayout/PlankControls.tsx +3 -5
- package/src/components/DeckLayout/Sidebar.tsx +22 -26
- package/src/components/DeckLayout/SidebarButton.tsx +74 -0
- package/src/components/DeckLayout/StatusBar.tsx +2 -2
- package/src/components/DeckLayout/Toast.tsx +19 -6
- package/src/components/DeckLayout/Topbar.tsx +11 -0
- package/src/components/fragments.ts +6 -0
- package/src/events.ts +11 -0
- package/src/index.ts +3 -4
- package/src/meta.ts +2 -2
- package/src/translations.ts +5 -0
- package/src/types.ts +27 -37
- package/src/util/index.ts +1 -1
- package/src/util/useBreakpoints.ts +11 -0
- package/src/util/useHoistStatusbar.ts +15 -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/util/check-app-scheme.d.ts +0 -2
- package/dist/types/src/util/check-app-scheme.d.ts.map +0 -1
- package/src/DeckPlugin.tsx +0 -657
- package/src/util/check-app-scheme.ts +0 -21
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DECK_PLUGIN
|
|
3
|
+
} from "./chunk-JQJ5UWVB.mjs";
|
|
4
|
+
|
|
5
|
+
// packages/plugins/plugin-deck/src/capabilities/layout/app-graph-builder.ts
|
|
6
|
+
import { Capabilities, contributes, createIntent, LayoutAction, NavigationAction, openIds } from "@dxos/app-framework";
|
|
7
|
+
import { AttentionCapabilities } from "@dxos/plugin-attention";
|
|
8
|
+
import { createExtension, ROOT_ID } from "@dxos/plugin-graph";
|
|
9
|
+
var app_graph_builder_default = (context) => contributes(Capabilities.AppGraphBuilder, createExtension({
|
|
10
|
+
id: DECK_PLUGIN,
|
|
11
|
+
filter: (node) => node.id === ROOT_ID,
|
|
12
|
+
actions: () => {
|
|
13
|
+
const _fullscreen = {
|
|
14
|
+
id: `${LayoutAction.SetLayoutMode._tag}/fullscreen`,
|
|
15
|
+
data: async () => {
|
|
16
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
17
|
+
await dispatch(createIntent(LayoutAction.SetLayoutMode, {
|
|
18
|
+
layoutMode: "fullscreen"
|
|
19
|
+
}));
|
|
20
|
+
},
|
|
21
|
+
properties: {
|
|
22
|
+
label: [
|
|
23
|
+
"toggle fullscreen label",
|
|
24
|
+
{
|
|
25
|
+
ns: DECK_PLUGIN
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
icon: "ph--arrows-out--regular",
|
|
29
|
+
keyBinding: {
|
|
30
|
+
macos: "ctrl+meta+f",
|
|
31
|
+
windows: "shift+ctrl+f"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const closeCurrent = {
|
|
36
|
+
id: `${NavigationAction.Close._tag}/current`,
|
|
37
|
+
data: async () => {
|
|
38
|
+
const attention = context.requestCapability(AttentionCapabilities.Attention);
|
|
39
|
+
const attended = attention.current.at(-1);
|
|
40
|
+
if (attended) {
|
|
41
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
42
|
+
await dispatch(createIntent(NavigationAction.Close, {
|
|
43
|
+
activeParts: {
|
|
44
|
+
main: [
|
|
45
|
+
attended
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
properties: {
|
|
52
|
+
label: [
|
|
53
|
+
"close current label",
|
|
54
|
+
{
|
|
55
|
+
ns: DECK_PLUGIN
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
icon: "ph--x--regular"
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const closeOthers = {
|
|
62
|
+
id: `${NavigationAction.Close._tag}/others`,
|
|
63
|
+
data: async () => {
|
|
64
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
65
|
+
const location = context.requestCapability(Capabilities.Location);
|
|
66
|
+
const attention = context.requestCapability(AttentionCapabilities.Attention);
|
|
67
|
+
const attended = attention.current.at(-1);
|
|
68
|
+
const ids = openIds(location.active, [
|
|
69
|
+
"main"
|
|
70
|
+
]).filter((id) => id !== attended);
|
|
71
|
+
await dispatch(createIntent(NavigationAction.Close, {
|
|
72
|
+
activeParts: {
|
|
73
|
+
main: ids
|
|
74
|
+
}
|
|
75
|
+
}));
|
|
76
|
+
},
|
|
77
|
+
properties: {
|
|
78
|
+
label: [
|
|
79
|
+
"close others label",
|
|
80
|
+
{
|
|
81
|
+
ns: DECK_PLUGIN
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
icon: "ph--x-square--regular"
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const closeAll = {
|
|
88
|
+
id: `${NavigationAction.Close._tag}/all`,
|
|
89
|
+
data: async () => {
|
|
90
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
91
|
+
const location = context.requestCapability(Capabilities.Location);
|
|
92
|
+
await dispatch(createIntent(NavigationAction.Close, {
|
|
93
|
+
activeParts: {
|
|
94
|
+
main: openIds(location.active, [
|
|
95
|
+
"main"
|
|
96
|
+
])
|
|
97
|
+
}
|
|
98
|
+
}));
|
|
99
|
+
},
|
|
100
|
+
properties: {
|
|
101
|
+
label: [
|
|
102
|
+
"close all label",
|
|
103
|
+
{
|
|
104
|
+
ns: DECK_PLUGIN
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
icon: "ph--x-circle--regular"
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const layoutMode = context.requestCapabilities(Capabilities.Layout)[0]?.layoutMode;
|
|
111
|
+
return layoutMode === "deck" ? [
|
|
112
|
+
closeCurrent,
|
|
113
|
+
closeOthers,
|
|
114
|
+
closeAll
|
|
115
|
+
] : [];
|
|
116
|
+
}
|
|
117
|
+
}));
|
|
118
|
+
export {
|
|
119
|
+
app_graph_builder_default as default
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=app-graph-builder-67VRUD5K.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/layout/app-graph-builder.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport {\n Capabilities,\n contributes,\n createIntent,\n LayoutAction,\n NavigationAction,\n openIds,\n type PluginsContext,\n} from '@dxos/app-framework';\nimport { AttentionCapabilities } from '@dxos/plugin-attention';\nimport { createExtension, type Node, ROOT_ID } from '@dxos/plugin-graph';\n\nimport { DECK_PLUGIN } from '../../meta';\n\nexport default (context: PluginsContext) =>\n contributes(\n Capabilities.AppGraphBuilder,\n createExtension({\n id: DECK_PLUGIN,\n filter: (node): node is Node<null> => node.id === ROOT_ID,\n actions: () => {\n // NOTE(Zan): This is currently disabled.\n // TODO(Zan): Fullscreen needs to know the active node and provide that to the layout part.\n const _fullscreen = {\n id: `${LayoutAction.SetLayoutMode._tag}/fullscreen`,\n data: async () => {\n const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);\n await dispatch(createIntent(LayoutAction.SetLayoutMode, { layoutMode: 'fullscreen' }));\n },\n properties: {\n label: ['toggle fullscreen label', { ns: DECK_PLUGIN }],\n icon: 'ph--arrows-out--regular',\n keyBinding: {\n macos: 'ctrl+meta+f',\n windows: 'shift+ctrl+f',\n },\n },\n };\n\n const closeCurrent = {\n id: `${NavigationAction.Close._tag}/current`,\n data: async () => {\n const attention = context.requestCapability(AttentionCapabilities.Attention);\n const attended = attention.current.at(-1);\n if (attended) {\n const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);\n await dispatch(createIntent(NavigationAction.Close, { activeParts: { main: [attended] } }));\n }\n },\n properties: {\n label: ['close current label', { ns: DECK_PLUGIN }],\n icon: 'ph--x--regular',\n },\n };\n\n const closeOthers = {\n id: `${NavigationAction.Close._tag}/others`,\n data: async () => {\n const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);\n const location = context.requestCapability(Capabilities.Location);\n const attention = context.requestCapability(AttentionCapabilities.Attention);\n const attended = attention.current.at(-1);\n const ids = openIds(location.active, ['main']).filter((id) => id !== attended);\n await dispatch(\n createIntent(NavigationAction.Close, {\n activeParts: { main: ids },\n }),\n );\n },\n properties: {\n label: ['close others label', { ns: DECK_PLUGIN }],\n icon: 'ph--x-square--regular',\n },\n };\n\n const closeAll = {\n id: `${NavigationAction.Close._tag}/all`,\n data: async () => {\n const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);\n const location = context.requestCapability(Capabilities.Location);\n await dispatch(\n createIntent(NavigationAction.Close, {\n activeParts: { main: openIds(location.active, ['main']) },\n }),\n );\n },\n properties: {\n label: ['close all label', { ns: DECK_PLUGIN }],\n icon: 'ph--x-circle--regular',\n },\n };\n\n const layoutMode = context.requestCapabilities(Capabilities.Layout)[0]?.layoutMode;\n return layoutMode === 'deck' ? [closeCurrent, closeOthers, closeAll] : [];\n },\n }),\n );\n"],
|
|
5
|
+
"mappings": ";;;;;AAIA,SACEA,cACAC,aACAC,cACAC,cACAC,kBACAC,eAEK;AACP,SAASC,6BAA6B;AACtC,SAASC,iBAA4BC,eAAe;AAIpD,IAAA,4BAAe,CAACC,YACdC,YACEC,aAAaC,iBACbC,gBAAgB;EACdC,IAAIC;EACJC,QAAQ,CAACC,SAA6BA,KAAKH,OAAOI;EAClDC,SAAS,MAAA;AAGP,UAAMC,cAAc;MAClBN,IAAI,GAAGO,aAAaC,cAAcC,IAAI;MACtCC,MAAM,YAAA;AACJ,cAAM,EAAEC,iBAAiBC,SAAQ,IAAKjB,QAAQkB,kBAAkBhB,aAAaiB,gBAAgB;AAC7F,cAAMF,SAASG,aAAaR,aAAaC,eAAe;UAAEQ,YAAY;QAAa,CAAA,CAAA;MACrF;MACAC,YAAY;QACVC,OAAO;UAAC;UAA2B;YAAEC,IAAIlB;UAAY;;QACrDmB,MAAM;QACNC,YAAY;UACVC,OAAO;UACPC,SAAS;QACX;MACF;IACF;AAEA,UAAMC,eAAe;MACnBxB,IAAI,GAAGyB,iBAAiBC,MAAMjB,IAAI;MAClCC,MAAM,YAAA;AACJ,cAAMiB,YAAYhC,QAAQkB,kBAAkBe,sBAAsBC,SAAS;AAC3E,cAAMC,WAAWH,UAAUI,QAAQC,GAAG,EAAC;AACvC,YAAIF,UAAU;AACZ,gBAAM,EAAEn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J;MACAvB,YAAY;QACVC,OAAO;UAAC;UAAmB;YAAEC,IAAIlB;UAAY;;QAC7CmB,MAAM;MACR;IACF;AAEA,UAAMJ,aAAarB,QAAQ+C,oBAAoB7C,aAAa8C,MAAM,EAAE,CAAA,GAAI3B;AACxE,WAAOA,eAAe,SAAS;MAACQ;MAAcW;MAAaM;QAAY,CAAA;EACzE;AACF,CAAA,CAAA;",
|
|
6
|
+
"names": ["Capabilities", "contributes", "createIntent", "LayoutAction", "NavigationAction", "openIds", "AttentionCapabilities", "createExtension", "ROOT_ID", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "DECK_PLUGIN", "filter", "node", "ROOT_ID", "actions", "_fullscreen", "LayoutAction", "SetLayoutMode", "_tag", "data", "dispatchPromise", "dispatch", "requestCapability", "IntentDispatcher", "createIntent", "layoutMode", "properties", "label", "ns", "icon", "keyBinding", "macos", "windows", "closeCurrent", "NavigationAction", "Close", "attention", "AttentionCapabilities", "Attention", "attended", "current", "at", "activeParts", "main", "closeOthers", "location", "Location", "ids", "openIds", "active", "closeAll", "requestCapabilities", "Layout"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DECK_PLUGIN
|
|
3
|
+
} from "./chunk-JQJ5UWVB.mjs";
|
|
4
|
+
|
|
5
|
+
// packages/plugins/plugin-deck/src/capabilities/navigation/check-app-scheme.ts
|
|
6
|
+
import { Capabilities, contributes } from "@dxos/app-framework";
|
|
7
|
+
var isSocket = !!globalThis.__args;
|
|
8
|
+
var appScheme = "composer://";
|
|
9
|
+
var checkAppScheme = (url) => {
|
|
10
|
+
const iframe = document.createElement("iframe");
|
|
11
|
+
iframe.style.display = "none";
|
|
12
|
+
document.body.appendChild(iframe);
|
|
13
|
+
iframe.src = url + window.location.pathname.replace(/^\/+/, "") + window.location.search;
|
|
14
|
+
const timer = setTimeout(() => {
|
|
15
|
+
document.body.removeChild(iframe);
|
|
16
|
+
}, 3e3);
|
|
17
|
+
window.addEventListener("pagehide", (event) => {
|
|
18
|
+
clearTimeout(timer);
|
|
19
|
+
document.body.removeChild(iframe);
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var check_app_scheme_default = async (context) => {
|
|
23
|
+
const settingsStore = context.requestCapability(Capabilities.SettingsStore);
|
|
24
|
+
const settings = settingsStore.getStore(DECK_PLUGIN)?.value;
|
|
25
|
+
if (!isSocket && settings?.enableNativeRedirect) {
|
|
26
|
+
checkAppScheme(appScheme);
|
|
27
|
+
}
|
|
28
|
+
return contributes(Capabilities.Null, null);
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
check_app_scheme_default as default
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=check-app-scheme-GEX6W2R5.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/navigation/check-app-scheme.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes, type PluginsContext } from '@dxos/app-framework';\n\nimport { DECK_PLUGIN } from '../../meta';\nimport { type DeckSettingsProps } from '../../types';\n\nconst isSocket = !!(globalThis as any).__args;\n\n// TODO(mjamesderocher): Can we get this directly from Socket?\nconst appScheme = 'composer://';\n\n// TODO(mjamesderocher): Factor out as part of NavigationPlugin.\nconst checkAppScheme = (url: string) => {\n const iframe = document.createElement('iframe');\n iframe.style.display = 'none';\n document.body.appendChild(iframe);\n\n iframe.src = url + window.location.pathname.replace(/^\\/+/, '') + window.location.search;\n\n const timer = setTimeout(() => {\n document.body.removeChild(iframe);\n }, 3000);\n\n window.addEventListener('pagehide', (event) => {\n clearTimeout(timer);\n document.body.removeChild(iframe);\n });\n};\n\nexport default async (context: PluginsContext) => {\n const settingsStore = context.requestCapability(Capabilities.SettingsStore);\n const settings = settingsStore.getStore<DeckSettingsProps>(DECK_PLUGIN)?.value;\n if (!isSocket && settings?.enableNativeRedirect) {\n checkAppScheme(appScheme);\n }\n\n return contributes(Capabilities.Null, null);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;AAOA,SAASA,cAAcC,mBAAwC;AAK/D,IAAMC,WAAW,CAAC,CAAEC,WAAmBC;AAGvC,IAAMC,YAAY;AAGlB,IAAMC,iBAAiB,CAACC,QAAAA;AACtB,QAAMC,SAASC,SAASC,cAAc,QAAA;AACtCF,SAAOG,MAAMC,UAAU;AACvBH,WAASI,KAAKC,YAAYN,MAAAA;AAE1BA,SAAOO,MAAMR,MAAMS,OAAOC,SAASC,SAASC,QAAQ,QAAQ,EAAA,IAAMH,OAAOC,SAASG;AAElF,QAAMC,QAAQC,WAAW,MAAA;AACvBb,aAASI,KAAKU,YAAYf,MAAAA;EAC5B,GAAG,GAAA;AAEHQ,SAAOQ,iBAAiB,YAAY,CAACC,UAAAA;AACnCC,iBAAaL,KAAAA;AACbZ,aAASI,KAAKU,YAAYf,MAAAA;EAC5B,CAAA;AACF;AAEA,IAAA,2BAAe,OAAOmB,YAAAA;AACpB,QAAMC,gBAAgBD,QAAQE,kBAAkBC,aAAaC,aAAa;AAC1E,QAAMC,WAAWJ,cAAcK,SAA4BC,WAAAA,GAAcC;AACzE,MAAI,CAACjC,YAAY8B,UAAUI,sBAAsB;AAC/C9B,mBAAeD,SAAAA;EACjB;AAEA,SAAOgC,YAAYP,aAAaQ,MAAM,IAAA;AACxC;",
|
|
6
|
+
"names": ["Capabilities", "contributes", "isSocket", "globalThis", "__args", "appScheme", "checkAppScheme", "url", "iframe", "document", "createElement", "style", "display", "body", "appendChild", "src", "window", "location", "pathname", "replace", "search", "timer", "setTimeout", "removeChild", "addEventListener", "event", "clearTimeout", "context", "settingsStore", "requestCapability", "Capabilities", "SettingsStore", "settings", "getStore", "DECK_PLUGIN", "value", "enableNativeRedirect", "contributes", "Null"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// packages/plugins/plugin-deck/src/util/layout-parts.ts
|
|
2
|
+
var getEffectivePart = (partName, layoutMode) => layoutMode === "solo" && partName === "main" ? "solo" : partName;
|
|
3
|
+
|
|
4
|
+
// packages/plugins/plugin-deck/src/util/overscroll.ts
|
|
5
|
+
var calculateOverscroll = (planksCount) => {
|
|
6
|
+
if (!planksCount) {
|
|
7
|
+
return {
|
|
8
|
+
paddingInlineStart: 0,
|
|
9
|
+
paddingInlineEnd: 0
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
if (planksCount === 1) {
|
|
13
|
+
const overscrollPadding = "max(0px, calc(((100dvw - var(--dx-main-sidebarWidth) - var(--dx-main-complementaryWidth) - (var(--dx-main-contentFirstWidth) + 1px)) / 2)))";
|
|
14
|
+
return {
|
|
15
|
+
paddingInlineStart: overscrollPadding,
|
|
16
|
+
paddingInlineEnd: overscrollPadding
|
|
17
|
+
};
|
|
18
|
+
} else {
|
|
19
|
+
return {
|
|
20
|
+
paddingInlineStart: "max(0px, calc(((100dvw - (var(--dx-main-contentFirstWidth) + 1px)) / 2) - var(--dx-main-sidebarWidth)))",
|
|
21
|
+
paddingInlineEnd: "max(0px, calc(((100dvw - (var(--dx-main-contentLastWidth) + 1px)) / 2) - var(--dx-main-complementaryWidth)))"
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// packages/plugins/plugin-deck/src/util/useBreakpoints.ts
|
|
27
|
+
import { useMediaQuery } from "@dxos/react-ui";
|
|
28
|
+
var useBreakpoints = () => {
|
|
29
|
+
const [isNotMobile] = useMediaQuery("md");
|
|
30
|
+
const [isDesktop] = useMediaQuery("lg");
|
|
31
|
+
return isDesktop ? "desktop" : isNotMobile ? "tablet" : "mobile";
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
getEffectivePart,
|
|
36
|
+
calculateOverscroll,
|
|
37
|
+
useBreakpoints
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=chunk-2PJNBVCY.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/util/layout-parts.ts", "../../../src/util/overscroll.ts", "../../../src/util/useBreakpoints.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { type LayoutMode, type LayoutPart } from '@dxos/app-framework';\n\n/**\n * If in solo mode and the part is the main part, open it in solo mode.\n * From the dispatch POV we refer to both 'solo' and 'main' as 'main'.\n */\nexport const getEffectivePart = (partName: LayoutPart, layoutMode: LayoutMode): LayoutPart =>\n layoutMode === 'solo' && partName === 'main' ? 'solo' : partName;\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"],
|
|
5
|
+
"mappings": ";AAUO,IAAMA,mBAAmB,CAACC,UAAsBC,eACrDA,eAAe,UAAUD,aAAa,SAAS,SAASA;;;ACuCnD,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;",
|
|
6
|
+
"names": ["getEffectivePart", "partName", "layoutMode", "calculateOverscroll", "planksCount", "paddingInlineStart", "paddingInlineEnd", "overscrollPadding", "useMediaQuery", "useBreakpoints", "isNotMobile", "useMediaQuery", "isDesktop"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
// packages/plugins/plugin-deck/src/capabilities/navigation/set-location.ts
|
|
2
|
+
import { openIds } from "@dxos/app-framework";
|
|
3
|
+
var setLocation = ({ next, location, layout, attention }) => {
|
|
4
|
+
const part = layout.layoutMode === "solo" ? "solo" : "main";
|
|
5
|
+
const ids = openIds(next, [
|
|
6
|
+
part
|
|
7
|
+
]);
|
|
8
|
+
const current = openIds(location.active, [
|
|
9
|
+
part
|
|
10
|
+
]);
|
|
11
|
+
const removed = current.filter((id) => !ids.includes(id));
|
|
12
|
+
const closed = Array.from(/* @__PURE__ */ new Set([
|
|
13
|
+
...location.closed.filter((id) => !ids.includes(id)),
|
|
14
|
+
...removed
|
|
15
|
+
]));
|
|
16
|
+
location.closed = closed;
|
|
17
|
+
location.active = next;
|
|
18
|
+
if (attention) {
|
|
19
|
+
const attended = attention.current;
|
|
20
|
+
const [attendedId] = Array.from(attended);
|
|
21
|
+
const isAttendedAvailable = !!attendedId && ids.includes(attendedId);
|
|
22
|
+
if (!isAttendedAvailable) {
|
|
23
|
+
const currentIds = location.active[part]?.map(({ id }) => id) ?? [];
|
|
24
|
+
const attendedIndex = currentIds.indexOf(attendedId);
|
|
25
|
+
const index = attendedIndex === -1 ? 0 : attendedIndex >= ids.length ? ids.length - 1 : attendedIndex;
|
|
26
|
+
return next[part]?.[index].id;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// packages/plugins/plugin-deck/src/layout.ts
|
|
32
|
+
import { produce } from "immer";
|
|
33
|
+
import { SLUG_ENTRY_SEPARATOR, SLUG_KEY_VALUE_SEPARATOR, SLUG_LIST_SEPARATOR, SLUG_PATH_SEPARATOR } from "@dxos/app-framework";
|
|
34
|
+
var partsThatSupportIncrement = [
|
|
35
|
+
"main"
|
|
36
|
+
];
|
|
37
|
+
var openEntry = (layout, part, entry, options) => {
|
|
38
|
+
return produce(layout, (draft) => {
|
|
39
|
+
const layoutPart = draft[part];
|
|
40
|
+
if (!layoutPart) {
|
|
41
|
+
draft[part] = [
|
|
42
|
+
entry
|
|
43
|
+
];
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (part === "main") {
|
|
47
|
+
if (layoutPart.find((e) => e.id === entry.id)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const plankPositioning = options?.positioning ?? "start";
|
|
51
|
+
const pivotId = options?.pivotId;
|
|
52
|
+
if (pivotId) {
|
|
53
|
+
const pivotIndex = layoutPart.findIndex((e) => e.id === pivotId);
|
|
54
|
+
if (pivotIndex !== -1) {
|
|
55
|
+
if (plankPositioning === "start") {
|
|
56
|
+
layoutPart.splice(pivotIndex, 0, entry);
|
|
57
|
+
} else {
|
|
58
|
+
layoutPart.splice(pivotIndex + 1, 0, entry);
|
|
59
|
+
}
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (plankPositioning === "start") {
|
|
64
|
+
layoutPart.unshift(entry);
|
|
65
|
+
} else {
|
|
66
|
+
layoutPart.push(entry);
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
draft[part] = [
|
|
70
|
+
entry
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
var closeEntry = (layout, layoutCoordinate) => {
|
|
76
|
+
return produce(layout, (draft) => {
|
|
77
|
+
const { part, entryId: slugId } = layoutCoordinate;
|
|
78
|
+
const layoutPart = draft[part];
|
|
79
|
+
if (!layoutPart) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const index = layoutPart.findIndex((entry) => entry.id === slugId);
|
|
83
|
+
if (index === -1) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (layoutPart.length === 1) {
|
|
87
|
+
delete draft[part];
|
|
88
|
+
} else {
|
|
89
|
+
layoutPart.splice(index, 1);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
var incrementPlank = (layout, adjustment) => {
|
|
94
|
+
return produce(layout, (draft) => {
|
|
95
|
+
const { layoutCoordinate, type } = adjustment;
|
|
96
|
+
const { part, entryId } = layoutCoordinate;
|
|
97
|
+
if (partsThatSupportIncrement.includes(part) === false) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const layoutPart = draft[part];
|
|
101
|
+
if (!layoutPart) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const index = layoutPart.findIndex((entry) => entry.id === entryId);
|
|
105
|
+
if (index === -1 || type === "increment-start" && index === 0 || type === "increment-end" && index === layoutPart.length - 1) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (type === "increment-start") {
|
|
109
|
+
[layoutPart[index - 1], layoutPart[index]] = [
|
|
110
|
+
layoutPart[index],
|
|
111
|
+
layoutPart[index - 1]
|
|
112
|
+
];
|
|
113
|
+
} else if (type === "increment-end") {
|
|
114
|
+
[layoutPart[index], layoutPart[index + 1]] = [
|
|
115
|
+
layoutPart[index + 1],
|
|
116
|
+
layoutPart[index]
|
|
117
|
+
];
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
var removePart = (layout, part) => {
|
|
122
|
+
return produce(layout, (draft) => {
|
|
123
|
+
delete draft[part];
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
var mergeLayoutParts = (...layoutParts) => {
|
|
127
|
+
return layoutParts.reduce((merged, current) => produce(merged, (draft) => {
|
|
128
|
+
Object.entries(current).forEach(([part, entries]) => {
|
|
129
|
+
const typedPart = part;
|
|
130
|
+
if (!draft[typedPart]) {
|
|
131
|
+
draft[typedPart] = [];
|
|
132
|
+
}
|
|
133
|
+
const partEntries = draft[typedPart];
|
|
134
|
+
entries.forEach((entry) => {
|
|
135
|
+
const existingIndex = partEntries.findIndex((e) => e.id === entry.id);
|
|
136
|
+
if (existingIndex !== -1) {
|
|
137
|
+
partEntries[existingIndex] = entry;
|
|
138
|
+
} else {
|
|
139
|
+
partEntries.push(entry);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
}), {});
|
|
144
|
+
};
|
|
145
|
+
var parseLayoutEntry = (itemString) => {
|
|
146
|
+
const [id, path] = itemString.split(SLUG_PATH_SEPARATOR);
|
|
147
|
+
const entry = {
|
|
148
|
+
id
|
|
149
|
+
};
|
|
150
|
+
if (path) {
|
|
151
|
+
entry.path = path;
|
|
152
|
+
}
|
|
153
|
+
return entry;
|
|
154
|
+
};
|
|
155
|
+
var uriToSoloPart = (uri) => {
|
|
156
|
+
const parts = uri.split("/");
|
|
157
|
+
const slug = parts[parts.length - 1];
|
|
158
|
+
if (slug.length > 0) {
|
|
159
|
+
return {
|
|
160
|
+
solo: [
|
|
161
|
+
parseLayoutEntry(slug)
|
|
162
|
+
]
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
return void 0;
|
|
166
|
+
};
|
|
167
|
+
var soloPartToUri = (layout) => {
|
|
168
|
+
const soloPart = layout?.solo;
|
|
169
|
+
if (!soloPart || soloPart.length === 0) {
|
|
170
|
+
return "";
|
|
171
|
+
}
|
|
172
|
+
const entry = soloPart[0];
|
|
173
|
+
return `${entry.id}${entry.path ? SLUG_PATH_SEPARATOR + entry.path : ""}`;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export {
|
|
177
|
+
setLocation,
|
|
178
|
+
openEntry,
|
|
179
|
+
closeEntry,
|
|
180
|
+
incrementPlank,
|
|
181
|
+
removePart,
|
|
182
|
+
mergeLayoutParts,
|
|
183
|
+
uriToSoloPart,
|
|
184
|
+
soloPartToUri
|
|
185
|
+
};
|
|
186
|
+
//# sourceMappingURL=chunk-4C2AFTET.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/navigation/set-location.ts", "../../../src/layout.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { openIds, type Layout, type LayoutParts, type Capabilities } from '@dxos/app-framework';\nimport { type AttentionManager } from '@dxos/plugin-attention';\n\nexport type SetLocationOptions = {\n next: LayoutParts;\n location: Capabilities.MutableLocation;\n layout: Layout;\n attention?: AttentionManager;\n};\n\nexport const setLocation = ({ next, location, layout, attention }: SetLocationOptions) => {\n const part = layout.layoutMode === 'solo' ? 'solo' : 'main';\n const ids = openIds(next, [part]);\n\n const current = openIds(location.active, [part]);\n const removed = current.filter((id) => !ids.includes(id));\n const closed = Array.from(new Set([...location.closed.filter((id) => !ids.includes(id)), ...removed]));\n\n location.closed = closed;\n location.active = next;\n\n if (attention) {\n const attended = attention.current;\n const [attendedId] = Array.from(attended);\n const isAttendedAvailable = !!attendedId && ids.includes(attendedId);\n if (!isAttendedAvailable) {\n const currentIds = location.active[part]?.map(({ id }) => id) ?? [];\n const attendedIndex = currentIds.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 >= ids.length ? ids.length - 1 : attendedIndex;\n return next[part]?.[index].id;\n }\n }\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { produce } from 'immer';\n\nimport {\n type LayoutAdjustment,\n type LayoutCoordinate,\n type LayoutEntry,\n type LayoutPart,\n type LayoutParts,\n SLUG_ENTRY_SEPARATOR,\n SLUG_KEY_VALUE_SEPARATOR,\n SLUG_LIST_SEPARATOR,\n SLUG_PATH_SEPARATOR,\n} from '@dxos/app-framework';\n\nimport { type NewPlankPositioning } from './types';\n\n// Part feature support\nconst partsThatSupportIncrement = ['main'] as LayoutPart[];\n\n//\n// --- Layout Parts Manipulation ----------------------------------------------\n\ntype OpenLayoutEntryOptions = { positioning?: NewPlankPositioning; pivotId?: string };\n\nexport const openEntry = (\n layout: LayoutParts,\n part: LayoutPart,\n entry: LayoutEntry,\n options?: OpenLayoutEntryOptions,\n): LayoutParts => {\n return produce(layout, (draft) => {\n const layoutPart = draft[part];\n // If the part doesn't exist, create it.\n if (!layoutPart) {\n draft[part] = [entry];\n return;\n }\n if (part === 'main') {\n // Check that the entry is not already in the part\n if (layoutPart.find((e) => e.id === entry.id)) {\n return;\n }\n\n const plankPositioning = options?.positioning ?? 'start';\n const pivotId = options?.pivotId;\n\n if (pivotId) {\n const pivotIndex = layoutPart.findIndex((e) => e.id === pivotId);\n if (pivotIndex !== -1) {\n if (plankPositioning === 'start') {\n layoutPart.splice(pivotIndex, 0, entry);\n } else {\n layoutPart.splice(pivotIndex + 1, 0, entry);\n }\n return;\n }\n }\n\n // If no pivot found or provided, fall back to original behavior\n if (plankPositioning === 'start') {\n layoutPart.unshift(entry);\n } else {\n layoutPart.push(entry);\n }\n } else {\n // If the part is not main, we're going to replace the single entry in the part with the new entry.\n draft[part] = [entry];\n }\n });\n};\n\nexport const closeEntry = (layout: LayoutParts, layoutCoordinate: LayoutCoordinate): LayoutParts => {\n return produce(layout, (draft) => {\n const { part, entryId: slugId } = layoutCoordinate;\n const layoutPart = draft[part];\n if (!layoutPart) {\n return;\n }\n\n const index = layoutPart.findIndex((entry) => entry.id === slugId);\n if (index === -1) {\n return;\n }\n\n // If there's only one entry in the layout part, remove the whole part from the layout.\n if (layoutPart.length === 1) {\n delete draft[part];\n } else {\n layoutPart.splice(index, 1);\n }\n });\n};\n\nexport const incrementPlank = (layout: LayoutParts, adjustment: LayoutAdjustment): LayoutParts => {\n return produce(layout, (draft) => {\n const { layoutCoordinate, type } = adjustment;\n const { part, entryId } = layoutCoordinate;\n\n // Only allow adjustments in the 'main' part\n if (partsThatSupportIncrement.includes(part) === false) {\n return;\n }\n\n const layoutPart = draft[part];\n if (!layoutPart) {\n return;\n }\n const index = layoutPart.findIndex((entry) => entry.id === entryId);\n if (\n index === -1 ||\n (type === 'increment-start' && index === 0) ||\n (type === 'increment-end' && index === layoutPart.length - 1)\n ) {\n return;\n }\n\n if (type === 'increment-start') {\n // Swap the current item with the previous item.\n [layoutPart[index - 1], layoutPart[index]] = [layoutPart[index], layoutPart[index - 1]];\n } else if (type === 'increment-end') {\n // Swap the current item with the next item.\n [layoutPart[index], layoutPart[index + 1]] = [layoutPart[index + 1], layoutPart[index]];\n }\n });\n};\n\nexport const removePart = (layout: LayoutParts, part: LayoutPart): LayoutParts => {\n return produce(layout, (draft) => {\n delete draft[part];\n });\n};\n\nexport const mergeLayoutParts = (...layoutParts: LayoutParts[]): LayoutParts => {\n return layoutParts.reduce(\n (merged, current) =>\n produce(merged, (draft) => {\n Object.entries(current).forEach(([part, entries]) => {\n const typedPart = part as LayoutPart;\n\n if (!draft[typedPart]) {\n draft[typedPart] = [];\n }\n\n const partEntries = draft[typedPart] as LayoutEntry[];\n\n entries.forEach((entry) => {\n const existingIndex = partEntries.findIndex((e) => e.id === entry.id);\n if (existingIndex !== -1) {\n partEntries[existingIndex] = entry;\n } else {\n partEntries.push(entry);\n }\n });\n });\n }),\n {} as LayoutParts,\n );\n};\n\n//\n// URI Projection\n//\n\nconst parseLayoutEntry = (itemString: string): LayoutEntry => {\n // Layout entries are in the form of 'id~path' or just 'id'\n const [id, path] = itemString.split(SLUG_PATH_SEPARATOR);\n const entry: LayoutEntry = { id };\n if (path) {\n entry.path = path;\n }\n return entry;\n};\n\nexport const uriToSoloPart = (uri: string): LayoutParts | undefined => {\n // Now after the domain part, there will be a single ID with an optional path\n const parts = uri.split('/');\n const slug = parts[parts.length - 1]; // Take the last part of the URI\n\n if (slug.length > 0) {\n return {\n solo: [parseLayoutEntry(slug)],\n };\n }\n\n return undefined;\n};\n\nexport const soloPartToUri = (layout: LayoutParts): string => {\n const soloPart = layout?.solo;\n if (!soloPart || soloPart.length === 0) {\n return '';\n }\n\n const entry = soloPart[0];\n return `${entry.id}${entry.path ? SLUG_PATH_SEPARATOR + entry.path : ''}`;\n};\n\n/**\n * Converts a URI string into a LayoutParts object.\n * @deprecated Keeping these as a reference for now. We should remove these once we're sure we don't need them.\n */\nexport const uriToActiveParts = (uri: string): LayoutParts => {\n const parts = uri.split('/');\n const slug = parts[parts.length - 1]; // Take the last part of the URI\n\n if (!slug) {\n return {}; // Return an empty object if the slug is empty\n }\n\n return slug.split(SLUG_ENTRY_SEPARATOR).reduce((acc: LayoutParts, partDescriptor) => {\n const [part, layoutEntry] = partDescriptor.split(SLUG_KEY_VALUE_SEPARATOR);\n if (part && layoutEntry) {\n // TODO(Zan): Remove this cast.\n acc[part as LayoutPart] = layoutEntry.split(SLUG_LIST_SEPARATOR).map(parseLayoutEntry);\n }\n return acc;\n }, {} as LayoutParts);\n};\n\nconst formatLayoutEntry = ({ id, path }: LayoutEntry): string => {\n // NOTE(Zan): Format = `[SOLO_INDICATOR] ID [PATH_SEPARATOR PATH]`.\n let entry = '';\n entry += id;\n if (path) {\n entry += `${SLUG_PATH_SEPARATOR}${path}`;\n }\n return entry;\n};\n\nconst formatPartDescriptor = (part: LayoutPart, layoutEntries: LayoutEntry[]): string => {\n const formattedEntries = layoutEntries.map(formatLayoutEntry).join(SLUG_LIST_SEPARATOR);\n return `${part}${SLUG_KEY_VALUE_SEPARATOR}${formattedEntries}`;\n};\n\n/**\n * Converts a LayoutParts object into a URI string.\n * @deprecated Keeping these as a reference for now. We should remove these once we're sure we don't need them.\n */\nexport const activePartsToUri = (activeParts: LayoutParts): string => {\n return Object.entries(activeParts)\n .filter(([, layoutEntries]) => layoutEntries.length > 0) // Only include non-empty parts\n .map(([part, layoutEntries]) => formatPartDescriptor(part as LayoutPart, layoutEntries))\n .join(SLUG_ENTRY_SEPARATOR);\n};\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,eAAiE;AAUnE,IAAMC,cAAc,CAAC,EAAEC,MAAMC,UAAUC,QAAQC,UAAS,MAAsB;AACnF,QAAMC,OAAOF,OAAOG,eAAe,SAAS,SAAS;AACrD,QAAMC,MAAMC,QAAQP,MAAM;IAACI;GAAK;AAEhC,QAAMI,UAAUD,QAAQN,SAASQ,QAAQ;IAACL;GAAK;AAC/C,QAAMM,UAAUF,QAAQG,OAAO,CAACC,OAAO,CAACN,IAAIO,SAASD,EAAAA,CAAAA;AACrD,QAAME,SAASC,MAAMC,KAAK,oBAAIC,IAAI;OAAIhB,SAASa,OAAOH,OAAO,CAACC,OAAO,CAACN,IAAIO,SAASD,EAAAA,CAAAA;OAASF;GAAQ,CAAA;AAEpGT,WAASa,SAASA;AAClBb,WAASQ,SAAST;AAElB,MAAIG,WAAW;AACb,UAAMe,WAAWf,UAAUK;AAC3B,UAAM,CAACW,UAAAA,IAAcJ,MAAMC,KAAKE,QAAAA;AAChC,UAAME,sBAAsB,CAAC,CAACD,cAAcb,IAAIO,SAASM,UAAAA;AACzD,QAAI,CAACC,qBAAqB;AACxB,YAAMC,aAAapB,SAASQ,OAAOL,IAAAA,GAAOkB,IAAI,CAAC,EAAEV,GAAE,MAAOA,EAAAA,KAAO,CAAA;AACjE,YAAMW,gBAAg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AAMrB,QAAQkD,SAAS,CAAA;AACvB,SAAO,GAAGlD,MAAMO,EAAE,GAAGP,MAAMwC,OAAOE,sBAAsB1C,MAAMwC,OAAO,EAAA;AACvE;",
|
|
6
|
+
"names": ["openIds", "setLocation", "next", "location", "layout", "attention", "part", "layoutMode", "ids", "openIds", "current", "active", "removed", "filter", "id", "includes", "closed", "Array", "from", "Set", "attended", "attendedId", "isAttendedAvailable", "currentIds", "map", "attendedIndex", "indexOf", "index", "length", "produce", "SLUG_ENTRY_SEPARATOR", "SLUG_KEY_VALUE_SEPARATOR", "SLUG_LIST_SEPARATOR", "SLUG_PATH_SEPARATOR", "partsThatSupportIncrement", "openEntry", "layout", "part", "entry", "options", "produce", "draft", "layoutPart", "find", "e", "id", "plankPositioning", "positioning", "pivotId", "pivotIndex", "findIndex", "splice", "unshift", "push", "closeEntry", "layoutCoordinate", "entryId", "slugId", "index", "length", "incrementPlank", "adjustment", "type", "includes", "removePart", "mergeLayoutParts", "layoutParts", "reduce", "merged", "current", "Object", "entries", "forEach", "typedPart", "partEntries", "existingIndex", "parseLayoutEntry", "itemString", "path", "split", "SLUG_PATH_SEPARATOR", "uriToSoloPart", "uri", "parts", "slug", "solo", "undefined", "soloPartToUri", "soloPart"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DECK_PLUGIN
|
|
3
|
+
} from "./chunk-JQJ5UWVB.mjs";
|
|
4
|
+
|
|
5
|
+
// packages/plugins/plugin-deck/src/capabilities/capabilities.ts
|
|
6
|
+
import { defineCapability } from "@dxos/app-framework";
|
|
7
|
+
var DeckCapabilities;
|
|
8
|
+
(function(DeckCapabilities2) {
|
|
9
|
+
DeckCapabilities2.DeckState = defineCapability(`${DECK_PLUGIN}/capability/state`);
|
|
10
|
+
DeckCapabilities2.MutableDeckState = defineCapability(`${DECK_PLUGIN}/capability/state`);
|
|
11
|
+
DeckCapabilities2.ComplementaryPanel = defineCapability(`${DECK_PLUGIN}/capability/complementary-panel`);
|
|
12
|
+
})(DeckCapabilities || (DeckCapabilities = {}));
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
DeckCapabilities
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=chunk-5VFDMW5M.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/capabilities.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineCapability, type Label } from '@dxos/app-framework';\nimport { type DeepReadonly } from '@dxos/util';\n\nimport { type DeckContextType } from '../components';\nimport { DECK_PLUGIN } from '../meta';\n\nexport namespace DeckCapabilities {\n export const DeckState = defineCapability<DeepReadonly<DeckContextType>>(`${DECK_PLUGIN}/capability/state`);\n export const MutableDeckState = defineCapability<DeckContextType>(`${DECK_PLUGIN}/capability/state`);\n export const ComplementaryPanel = defineCapability<{ id: string; label: Label; icon: string }>(\n `${DECK_PLUGIN}/capability/complementary-panel`,\n );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;AAIA,SAASA,wBAAoC;;UAM5BC,mBAAAA;oBACFC,YAAYC,iBAAgD,GAAGC,WAAAA,mBAA8B;oBAC7FC,mBAAmBF,iBAAkC,GAAGC,WAAAA,mBAA8B;oBACtFE,qBAAqBH,iBAChC,GAAGC,WAAAA,iCAA4C;AAEnD,GANiBH,qBAAAA,mBAAAA,CAAAA,EAAAA;",
|
|
6
|
+
"names": ["defineCapability", "DeckCapabilities", "DeckState", "defineCapability", "DECK_PLUGIN", "MutableDeckState", "ComplementaryPanel"]
|
|
7
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// packages/plugins/plugin-deck/src/meta.ts
|
|
2
2
|
var DECK_PLUGIN = "dxos.org/plugin/deck";
|
|
3
|
-
var
|
|
3
|
+
var meta = {
|
|
4
4
|
id: DECK_PLUGIN,
|
|
5
5
|
name: "Deck"
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
export {
|
|
9
9
|
DECK_PLUGIN,
|
|
10
|
-
|
|
10
|
+
meta
|
|
11
11
|
};
|
|
12
|
-
//# sourceMappingURL=chunk-
|
|
12
|
+
//# sourceMappingURL=chunk-JQJ5UWVB.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const DECK_PLUGIN = 'dxos.org/plugin/deck' as const;\n\nexport const meta = {\n id: DECK_PLUGIN,\n name: 'Deck',\n} satisfies PluginMeta;\n"],
|
|
5
|
+
"mappings": ";AAMO,IAAMA,cAAc;AAEpB,IAAMC,OAAO;EAClBC,IAAIF;EACJG,MAAM;AACR;",
|
|
6
|
+
"names": ["DECK_PLUGIN", "meta", "id", "name"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DECK_PLUGIN
|
|
3
|
+
} from "./chunk-JQJ5UWVB.mjs";
|
|
4
|
+
|
|
5
|
+
// packages/plugins/plugin-deck/src/types.ts
|
|
6
|
+
import { S } from "@dxos/echo-schema";
|
|
7
|
+
var NewPlankPositions = [
|
|
8
|
+
"start",
|
|
9
|
+
"end"
|
|
10
|
+
];
|
|
11
|
+
var OverscrollOptions = [
|
|
12
|
+
"none",
|
|
13
|
+
"centering"
|
|
14
|
+
];
|
|
15
|
+
var DeckSettingsSchema = S.mutable(S.Struct({
|
|
16
|
+
showHints: S.Boolean,
|
|
17
|
+
customSlots: S.Boolean,
|
|
18
|
+
flatDeck: S.Boolean,
|
|
19
|
+
enableNativeRedirect: S.Boolean,
|
|
20
|
+
newPlankPositioning: S.Literal(...NewPlankPositions),
|
|
21
|
+
overscroll: S.Literal(...OverscrollOptions)
|
|
22
|
+
}));
|
|
23
|
+
var DECK_ACTION = `${DECK_PLUGIN}/action`;
|
|
24
|
+
var DeckAction;
|
|
25
|
+
(function(DeckAction2) {
|
|
26
|
+
class UpdatePlankSize extends S.TaggedClass()(`${DECK_ACTION}/update-plank-size`, {
|
|
27
|
+
input: S.Struct({
|
|
28
|
+
id: S.String,
|
|
29
|
+
size: S.Number
|
|
30
|
+
}),
|
|
31
|
+
output: S.Void
|
|
32
|
+
}) {
|
|
33
|
+
}
|
|
34
|
+
DeckAction2.UpdatePlankSize = UpdatePlankSize;
|
|
35
|
+
})(DeckAction || (DeckAction = {}));
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
NewPlankPositions,
|
|
39
|
+
OverscrollOptions,
|
|
40
|
+
DeckSettingsSchema,
|
|
41
|
+
DECK_ACTION,
|
|
42
|
+
DeckAction
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=chunk-KY5WXIXY.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/types.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { S } from '@dxos/echo-schema';\nimport { type Label } from '@dxos/react-ui';\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\n// TODO(wittjosiah): Include a predicate for whether the panel is visible for the current subject.\nexport type Panel = { id: string; label: Label; icon: string };\n\nexport const DeckSettingsSchema = S.mutable(\n S.Struct({\n showHints: S.Boolean,\n customSlots: S.Boolean,\n flatDeck: S.Boolean,\n enableNativeRedirect: S.Boolean,\n newPlankPositioning: S.Literal(...NewPlankPositions),\n overscroll: S.Literal(...OverscrollOptions),\n }),\n);\n\nexport type DeckSettingsProps = S.Schema.Type<typeof DeckSettingsSchema>;\n\nexport const DECK_ACTION = `${DECK_PLUGIN}/action`;\n\nexport namespace DeckAction {\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": ";;;;;AAIA,SAASA,SAAS;AAMX,IAAMC,oBAAoB;EAAC;EAAS;;AAGpC,IAAMC,oBAAoB;EAAC;EAAQ;;AAMnC,IAAMC,qBAAqBC,EAAEC,QAClCD,EAAEE,OAAO;EACPC,WAAWH,EAAEI;EACbC,aAAaL,EAAEI;EACfE,UAAUN,EAAEI;EACZG,sBAAsBP,EAAEI;EACxBI,qBAAqBR,EAAES,QAAO,GAAIZ,iBAAAA;EAClCa,YAAYV,EAAES,QAAO,GAAIX,iBAAAA;AAC3B,CAAA,CAAA;AAKK,IAAMa,cAAc,GAAGC,WAAAA;;UAEbC,aAAAA;EACR,MAAMC,wBAAwBd,EAAEe,YAAW,EAAoB,GAAGJ,WAAAA,sBAAiC;IACxGK,OAAOhB,EAAEE,OAAO;MACde,IAAIjB,EAAEkB;MACNC,MAAMnB,EAAEoB;IACV,CAAA;IACAC,QAAQrB,EAAEsB;EACZ,CAAA,EAAA;EAAI;cANSR,kBAAAA;AAOf,GARiBD,eAAAA,aAAAA,CAAAA,EAAAA;",
|
|
6
|
+
"names": ["S", "NewPlankPositions", "OverscrollOptions", "DeckSettingsSchema", "S", "mutable", "Struct", "showHints", "Boolean", "customSlots", "flatDeck", "enableNativeRedirect", "newPlankPositioning", "Literal", "overscroll", "DECK_ACTION", "DECK_PLUGIN", "DeckAction", "UpdatePlankSize", "TaggedClass", "input", "id", "String", "size", "Number", "output", "Void"]
|
|
7
|
+
}
|