@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.
Files changed (174) hide show
  1. package/dist/lib/browser/app-graph-builder-67VRUD5K.mjs +121 -0
  2. package/dist/lib/browser/app-graph-builder-67VRUD5K.mjs.map +7 -0
  3. package/dist/lib/browser/check-app-scheme-GEX6W2R5.mjs +33 -0
  4. package/dist/lib/browser/check-app-scheme-GEX6W2R5.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-2PJNBVCY.mjs +39 -0
  6. package/dist/lib/browser/chunk-2PJNBVCY.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-4C2AFTET.mjs +186 -0
  8. package/dist/lib/browser/chunk-4C2AFTET.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-5VFDMW5M.mjs +17 -0
  10. package/dist/lib/browser/chunk-5VFDMW5M.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-GVOGPULO.mjs → chunk-JQJ5UWVB.mjs} +3 -3
  12. package/dist/lib/browser/chunk-JQJ5UWVB.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-KY5WXIXY.mjs +44 -0
  14. package/dist/lib/browser/chunk-KY5WXIXY.mjs.map +7 -0
  15. package/dist/lib/browser/chunk-WUMAJGVA.mjs +1052 -0
  16. package/dist/lib/browser/chunk-WUMAJGVA.mjs.map +7 -0
  17. package/dist/lib/browser/deck-PLCSKPGL.mjs +26 -0
  18. package/dist/lib/browser/deck-PLCSKPGL.mjs.map +7 -0
  19. package/dist/lib/browser/index.mjs +142 -1803
  20. package/dist/lib/browser/index.mjs.map +4 -4
  21. package/dist/lib/browser/intent-resolver-FVOQSTBX.mjs +152 -0
  22. package/dist/lib/browser/intent-resolver-FVOQSTBX.mjs.map +7 -0
  23. package/dist/lib/browser/intent-resolver-K7GW4A2I.mjs +249 -0
  24. package/dist/lib/browser/intent-resolver-K7GW4A2I.mjs.map +7 -0
  25. package/dist/lib/browser/location-AIO6V3MK.mjs +35 -0
  26. package/dist/lib/browser/location-AIO6V3MK.mjs.map +7 -0
  27. package/dist/lib/browser/meta.json +1 -1
  28. package/dist/lib/browser/react-context-G6PDXUI5.mjs +32 -0
  29. package/dist/lib/browser/react-context-G6PDXUI5.mjs.map +7 -0
  30. package/dist/lib/browser/react-root-AWYSGU4Q.mjs +50 -0
  31. package/dist/lib/browser/react-root-AWYSGU4Q.mjs.map +7 -0
  32. package/dist/lib/browser/react-surface-CLUABFNX.mjs +28 -0
  33. package/dist/lib/browser/react-surface-CLUABFNX.mjs.map +7 -0
  34. package/dist/lib/browser/settings-FNWW6WIJ.mjs +29 -0
  35. package/dist/lib/browser/settings-FNWW6WIJ.mjs.map +7 -0
  36. package/dist/lib/browser/state-7I5BD7SE.mjs +34 -0
  37. package/dist/lib/browser/state-7I5BD7SE.mjs.map +7 -0
  38. package/dist/lib/browser/tools-4XY7KFQF.mjs +46 -0
  39. package/dist/lib/browser/tools-4XY7KFQF.mjs.map +7 -0
  40. package/dist/lib/browser/types.mjs +10 -5
  41. package/dist/lib/browser/url-handler-JRAQRY73.mjs +76 -0
  42. package/dist/lib/browser/url-handler-JRAQRY73.mjs.map +7 -0
  43. package/dist/types/src/DeckPlugin.d.ts +1 -14
  44. package/dist/types/src/DeckPlugin.d.ts.map +1 -1
  45. package/dist/types/src/capabilities/capabilities.d.ts +13 -0
  46. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  47. package/dist/types/src/capabilities/index.d.ts +5 -0
  48. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  49. package/dist/types/src/capabilities/layout/app-graph-builder.d.ts +181 -0
  50. package/dist/types/src/capabilities/layout/app-graph-builder.d.ts.map +1 -0
  51. package/dist/types/src/capabilities/layout/deck.d.ts +4 -0
  52. package/dist/types/src/capabilities/layout/deck.d.ts.map +1 -0
  53. package/dist/types/src/capabilities/layout/index.d.ts +229 -0
  54. package/dist/types/src/capabilities/layout/index.d.ts.map +1 -0
  55. package/dist/types/src/capabilities/layout/intent-resolver.d.ts +4 -0
  56. package/dist/types/src/capabilities/layout/intent-resolver.d.ts.map +1 -0
  57. package/dist/types/src/capabilities/layout/react-context.d.ts +8 -0
  58. package/dist/types/src/capabilities/layout/react-context.d.ts.map +1 -0
  59. package/dist/types/src/capabilities/layout/react-root.d.ts +7 -0
  60. package/dist/types/src/capabilities/layout/react-root.d.ts.map +1 -0
  61. package/dist/types/src/capabilities/layout/state.d.ts +42 -0
  62. package/dist/types/src/capabilities/layout/state.d.ts.map +1 -0
  63. package/dist/types/src/capabilities/navigation/check-app-scheme.d.ts +4 -0
  64. package/dist/types/src/capabilities/navigation/check-app-scheme.d.ts.map +1 -0
  65. package/dist/types/src/capabilities/navigation/index.d.ts +6 -0
  66. package/dist/types/src/capabilities/navigation/index.d.ts.map +1 -0
  67. package/dist/types/src/capabilities/navigation/intent-resolver.d.ts +4 -0
  68. package/dist/types/src/capabilities/navigation/intent-resolver.d.ts.map +1 -0
  69. package/dist/types/src/capabilities/navigation/location.d.ts +4 -0
  70. package/dist/types/src/capabilities/navigation/location.d.ts.map +1 -0
  71. package/dist/types/src/capabilities/navigation/set-location.d.ts +10 -0
  72. package/dist/types/src/capabilities/navigation/set-location.d.ts.map +1 -0
  73. package/dist/types/src/capabilities/navigation/tools.d.ts +9 -0
  74. package/dist/types/src/capabilities/navigation/tools.d.ts.map +1 -0
  75. package/dist/types/src/capabilities/navigation/url-handler.d.ts +4 -0
  76. package/dist/types/src/capabilities/navigation/url-handler.d.ts.map +1 -0
  77. package/dist/types/src/capabilities/settings/index.d.ts +3 -0
  78. package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
  79. package/dist/types/src/capabilities/settings/react-surface.d.ts +4 -0
  80. package/dist/types/src/capabilities/settings/react-surface.d.ts.map +1 -0
  81. package/dist/types/src/capabilities/settings/settings.d.ts +4 -0
  82. package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
  83. package/dist/types/src/components/DeckContext.d.ts +3 -0
  84. package/dist/types/src/components/DeckContext.d.ts.map +1 -1
  85. package/dist/types/src/components/DeckLayout/Banner.d.ts +6 -0
  86. package/dist/types/src/components/DeckLayout/Banner.d.ts.map +1 -0
  87. package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts.map +1 -1
  88. package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +1 -1
  89. package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
  90. package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts.map +1 -1
  91. package/dist/types/src/components/DeckLayout/Plank.d.ts +1 -1
  92. package/dist/types/src/components/DeckLayout/Plank.d.ts.map +1 -1
  93. package/dist/types/src/components/DeckLayout/PlankControls.d.ts +2 -2
  94. package/dist/types/src/components/DeckLayout/PlankControls.d.ts.map +1 -1
  95. package/dist/types/src/components/DeckLayout/Sidebar.d.ts +1 -5
  96. package/dist/types/src/components/DeckLayout/Sidebar.d.ts.map +1 -1
  97. package/dist/types/src/components/DeckLayout/SidebarButton.d.ts +6 -0
  98. package/dist/types/src/components/DeckLayout/SidebarButton.d.ts.map +1 -0
  99. package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
  100. package/dist/types/src/components/DeckLayout/Topbar.d.ts +3 -0
  101. package/dist/types/src/components/DeckLayout/Topbar.d.ts.map +1 -0
  102. package/dist/types/src/components/fragments.d.ts +2 -0
  103. package/dist/types/src/components/fragments.d.ts.map +1 -0
  104. package/dist/types/src/events.d.ts +4 -0
  105. package/dist/types/src/events.d.ts.map +1 -0
  106. package/dist/types/src/index.d.ts +3 -2
  107. package/dist/types/src/index.d.ts.map +1 -1
  108. package/dist/types/src/meta.d.ts +3 -4
  109. package/dist/types/src/meta.d.ts.map +1 -1
  110. package/dist/types/src/translations.d.ts +5 -0
  111. package/dist/types/src/translations.d.ts.map +1 -1
  112. package/dist/types/src/types.d.ts +25 -17
  113. package/dist/types/src/types.d.ts.map +1 -1
  114. package/dist/types/src/util/index.d.ts +1 -1
  115. package/dist/types/src/util/index.d.ts.map +1 -1
  116. package/dist/types/src/util/useBreakpoints.d.ts +2 -0
  117. package/dist/types/src/util/useBreakpoints.d.ts.map +1 -0
  118. package/dist/types/src/util/useHoistStatusbar.d.ts +2 -0
  119. package/dist/types/src/util/useHoistStatusbar.d.ts.map +1 -0
  120. package/dist/types/tsconfig.tsbuildinfo +1 -0
  121. package/package.json +31 -35
  122. package/src/DeckPlugin.ts +129 -0
  123. package/src/capabilities/capabilities.ts +17 -0
  124. package/src/capabilities/index.ts +8 -0
  125. package/src/capabilities/layout/app-graph-builder.ts +101 -0
  126. package/src/capabilities/layout/deck.ts +25 -0
  127. package/src/capabilities/layout/index.ts +12 -0
  128. package/src/capabilities/layout/intent-resolver.ts +128 -0
  129. package/src/capabilities/layout/react-context.tsx +26 -0
  130. package/src/capabilities/layout/react-root.tsx +52 -0
  131. package/src/capabilities/layout/state.ts +32 -0
  132. package/src/capabilities/navigation/check-app-scheme.ts +44 -0
  133. package/src/capabilities/navigation/index.ts +11 -0
  134. package/src/capabilities/navigation/intent-resolver.ts +216 -0
  135. package/src/capabilities/navigation/location.ts +28 -0
  136. package/src/capabilities/navigation/set-location.ts +38 -0
  137. package/src/capabilities/navigation/tools.ts +57 -0
  138. package/src/capabilities/navigation/url-handler.ts +67 -0
  139. package/src/capabilities/settings/index.ts +8 -0
  140. package/src/capabilities/settings/react-surface.tsx +23 -0
  141. package/src/capabilities/settings/settings.ts +22 -0
  142. package/src/components/DeckContext.ts +6 -1
  143. package/src/components/DeckLayout/ActiveNode.tsx +1 -1
  144. package/src/components/DeckLayout/Banner.tsx +37 -0
  145. package/src/components/DeckLayout/ComplementarySidebar.tsx +76 -53
  146. package/src/components/DeckLayout/ContentEmpty.tsx +10 -2
  147. package/src/components/DeckLayout/DeckLayout.tsx +31 -40
  148. package/src/components/DeckLayout/Fullscreen.tsx +1 -1
  149. package/src/components/DeckLayout/NodePlankHeading.tsx +30 -49
  150. package/src/components/DeckLayout/Plank.tsx +13 -11
  151. package/src/components/DeckLayout/PlankControls.tsx +3 -5
  152. package/src/components/DeckLayout/Sidebar.tsx +22 -26
  153. package/src/components/DeckLayout/SidebarButton.tsx +74 -0
  154. package/src/components/DeckLayout/StatusBar.tsx +2 -2
  155. package/src/components/DeckLayout/Toast.tsx +19 -6
  156. package/src/components/DeckLayout/Topbar.tsx +11 -0
  157. package/src/components/fragments.ts +6 -0
  158. package/src/events.ts +11 -0
  159. package/src/index.ts +3 -4
  160. package/src/meta.ts +2 -2
  161. package/src/translations.ts +5 -0
  162. package/src/types.ts +27 -37
  163. package/src/util/index.ts +1 -1
  164. package/src/util/useBreakpoints.ts +11 -0
  165. package/src/util/useHoistStatusbar.ts +15 -0
  166. package/dist/lib/browser/chunk-GVOGPULO.mjs.map +0 -7
  167. package/dist/lib/browser/chunk-NIRHDTX4.mjs +0 -17
  168. package/dist/lib/browser/chunk-NIRHDTX4.mjs.map +0 -7
  169. package/dist/lib/browser/meta.mjs +0 -9
  170. package/dist/lib/browser/meta.mjs.map +0 -7
  171. package/dist/types/src/util/check-app-scheme.d.ts +0 -2
  172. package/dist/types/src/util/check-app-scheme.d.ts.map +0 -1
  173. package/src/DeckPlugin.tsx +0 -657
  174. package/src/util/check-app-scheme.ts +0 -21
@@ -4,39 +4,35 @@
4
4
 
5
5
  import React, { useMemo } from 'react';
6
6
 
7
- import { type LayoutParts, openIds, Surface } from '@dxos/app-framework';
7
+ import { Surface } from '@dxos/app-framework';
8
8
  import { Main } from '@dxos/react-ui';
9
+ import { mx } from '@dxos/react-ui-theme';
9
10
 
11
+ import { Banner } from './Banner';
12
+ import { useBreakpoints } from '../../util';
13
+ import { useHoistStatusbar } from '../../util/useHoistStatusbar';
10
14
  import { useLayout } from '../LayoutContext';
11
15
 
12
- export type SidebarProps = {
13
- layoutParts: LayoutParts;
14
- };
15
-
16
- export const Sidebar = ({ layoutParts }: SidebarProps) => {
17
- const { layoutMode, popoverAnchorId } = useLayout();
16
+ export const Sidebar = () => {
17
+ const layoutContext = useLayout();
18
+ const { popoverAnchorId } = layoutContext;
19
+ const breakpoint = useBreakpoints();
20
+ const hoistStatusbar = useHoistStatusbar(breakpoint);
18
21
 
19
- // TODO(wittjosiah): The activeIds should be path-based to avoid conflicts.
20
- const activeIds = useMemo(() => {
21
- if (layoutMode === 'solo') {
22
- return Array.from(new Set<string>(layoutParts?.solo?.map((e) => e.id) ?? []));
23
- } else if (layoutMode === 'deck') {
24
- return Array.from(new Set<string>(layoutParts?.main?.map((e) => e.id) ?? []));
25
- }
22
+ const navigationData = useMemo(() => ({ popoverAnchorId }), [popoverAnchorId]);
26
23
 
27
- return Array.from(new Set<string>(openIds(layoutParts)));
28
- }, [layoutParts, layoutMode]);
29
-
30
- const navigationData = useMemo(
31
- () => ({
32
- popoverAnchorId,
33
- activeIds,
34
- }),
35
- [popoverAnchorId, activeIds],
36
- );
37
24
  return (
38
- <Main.NavigationSidebar>
39
- <Surface role='navigation' data={{ ...navigationData }} limit={1} />
25
+ <Main.NavigationSidebar classNames='grid grid-cols-1 grid-rows-[var(--rail-size)_var(--rail-action)_1fr_min-content_min-content] md:grid-rows-[var(--rail-size)_var(--rail-action)_1fr_min-content] lg:grid-rows-[1fr_min-content] overflow-hidden lg:block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]'>
26
+ {breakpoint !== 'desktop' && (
27
+ <>
28
+ <Banner variant='sidebar' />
29
+ <Surface role='search-input' limit={1} />
30
+ </>
31
+ )}
32
+ <div role='none' className={mx('!overflow-y-auto', breakpoint !== 'desktop' && 'border-be border-separator')}>
33
+ <Surface role='navigation' data={navigationData} limit={1} />
34
+ </div>
35
+ {!hoistStatusbar && <Surface role='status-bar--sidebar-footer' limit={1} />}
40
36
  </Main.NavigationSidebar>
41
37
  );
42
38
  };
@@ -0,0 +1,74 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { IconButton, useTranslation } from '@dxos/react-ui';
8
+
9
+ import { DECK_PLUGIN } from '../../meta';
10
+ import { useLayout } from '../LayoutContext';
11
+
12
+ export const ToggleSidebarButton = () => {
13
+ const layoutContext = useLayout();
14
+ const { t } = useTranslation(DECK_PLUGIN);
15
+ return (
16
+ <IconButton
17
+ variant='ghost'
18
+ iconOnly
19
+ icon='ph--sidebar--regular'
20
+ size={4}
21
+ label={t('open navigation sidebar label')}
22
+ onClick={() => (layoutContext.sidebarOpen = !layoutContext.sidebarOpen)}
23
+ classNames='!pli-2 order-first'
24
+ />
25
+ );
26
+ };
27
+
28
+ export const CloseSidebarButton = () => {
29
+ const layoutContext = useLayout();
30
+ const { t } = useTranslation(DECK_PLUGIN);
31
+ return (
32
+ <IconButton
33
+ variant='ghost'
34
+ iconOnly
35
+ icon='ph--caret-line-left--regular'
36
+ size={4}
37
+ label={t('close navigation sidebar label')}
38
+ onClick={() => (layoutContext.sidebarOpen = false)}
39
+ classNames='!rounded-none !pli-1 ch-focus-ring-inset pie-[max(.5rem,env(safe-area-inset-left))]'
40
+ />
41
+ );
42
+ };
43
+
44
+ export const ToggleComplementarySidebarButton = () => {
45
+ const layoutContext = useLayout();
46
+ const { t } = useTranslation(DECK_PLUGIN);
47
+ return (
48
+ <IconButton
49
+ iconOnly
50
+ onClick={() => (layoutContext.complementarySidebarOpen = !layoutContext.complementarySidebarOpen)}
51
+ variant='ghost'
52
+ label={t('open complementary sidebar label')}
53
+ classNames='!pli-2 !plb-3 [&>svg]:-scale-x-100'
54
+ icon='ph--sidebar-simple--regular'
55
+ size={4}
56
+ />
57
+ );
58
+ };
59
+
60
+ export const CloseComplementarySidebarButton = () => {
61
+ const layoutContext = useLayout();
62
+ const { t } = useTranslation(DECK_PLUGIN);
63
+ return (
64
+ <IconButton
65
+ iconOnly
66
+ variant='ghost'
67
+ size={4}
68
+ icon='ph--caret-line-right--regular'
69
+ label={t('close complementary sidebar label')}
70
+ classNames='!rounded-none border-is border-separator ch-focus-ring-inset pie-2 lg:pie-[max(.5rem,env(safe-area-inset-right))]'
71
+ onClick={() => (layoutContext.complementarySidebarOpen = false)}
72
+ />
73
+ );
74
+ };
@@ -13,10 +13,10 @@ export const StatusBar = ({ showHints }: { showHints?: boolean }) => {
13
13
  const sizeAttrs = useMainSize();
14
14
  return (
15
15
  <div
16
- role='none'
16
+ role='contentinfo'
17
17
  {...sizeAttrs}
18
18
  className={mx(
19
- 'fixed flex justify-between block-end-0 inset-inline-0 items-center border-bs border-separator z-[2]',
19
+ 'fixed block-end-0 inset-inline-0 flex justify-between items-center border-bs border-separator z-[2] pbe-[env(safe-area-inset-bottom)]',
20
20
  mainPadding,
21
21
  mainPaddingTransitions,
22
22
  )}
@@ -5,7 +5,16 @@
5
5
  import React from 'react';
6
6
 
7
7
  import type { Toast as ToastProps } from '@dxos/app-framework';
8
- import { Button, Icon, Toast as NaturalToast, type ToastRootProps } from '@dxos/react-ui';
8
+ import {
9
+ Button,
10
+ Icon,
11
+ Toast as NaturalToast,
12
+ toLocalizedString,
13
+ useTranslation,
14
+ type ToastRootProps,
15
+ } from '@dxos/react-ui';
16
+
17
+ import { DECK_PLUGIN } from '../../meta';
9
18
 
10
19
  // TODO(wittjosiah): Render remaining duration as a progress bar within the toast.
11
20
  export const Toast = ({
@@ -20,26 +29,30 @@ export const Toast = ({
20
29
  onAction,
21
30
  onOpenChange,
22
31
  }: ToastProps & Pick<ToastRootProps, 'onOpenChange'>) => {
32
+ const { t } = useTranslation(DECK_PLUGIN);
33
+
23
34
  return (
24
35
  <NaturalToast.Root data-testid={id} defaultOpen duration={duration} onOpenChange={onOpenChange}>
25
36
  <NaturalToast.Body>
26
37
  <NaturalToast.Title classNames='items-center'>
27
38
  {icon && <Icon icon={icon} size={5} classNames='inline mr-1' />}
28
- <span>{title}</span>
39
+ {title && <span>{toLocalizedString(title, t)}</span>}
29
40
  </NaturalToast.Title>
30
- {description && <NaturalToast.Description>{description}</NaturalToast.Description>}
41
+ {description && (
42
+ <NaturalToast.Description>{description && toLocalizedString(description, t)}</NaturalToast.Description>
43
+ )}
31
44
  </NaturalToast.Body>
32
45
  <NaturalToast.Actions>
33
46
  {onAction && actionAlt && actionLabel && (
34
- <NaturalToast.Action altText={actionAlt} asChild>
47
+ <NaturalToast.Action altText={toLocalizedString(actionAlt, t)} asChild>
35
48
  <Button data-testid='toast.action' variant='primary' onClick={() => onAction?.()}>
36
- {actionLabel}
49
+ {toLocalizedString(actionLabel, t)}
37
50
  </Button>
38
51
  </NaturalToast.Action>
39
52
  )}
40
53
  {closeLabel && (
41
54
  <NaturalToast.Close asChild>
42
- <Button data-testid='toast.close'>{closeLabel}</Button>
55
+ <Button data-testid='toast.close'>{toLocalizedString(closeLabel, t)}</Button>
43
56
  </NaturalToast.Close>
44
57
  )}
45
58
  </NaturalToast.Actions>
@@ -0,0 +1,11 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { Banner } from './Banner';
8
+
9
+ export const Topbar = () => {
10
+ return <Banner variant='topbar' />;
11
+ };
@@ -0,0 +1,6 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export const soloInlinePadding =
6
+ 'pis-[calc(env(safe-area-inset-left)+.25rem)] pie-[calc(env(safe-area-inset-left)+.25rem)]';
package/src/events.ts ADDED
@@ -0,0 +1,11 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Events } from '@dxos/app-framework';
6
+
7
+ import { DECK_PLUGIN } from './meta';
8
+
9
+ export namespace DeckEvents {
10
+ export const StateReady = Events.createStateEvent(`${DECK_PLUGIN}/state-ready`);
11
+ }
package/src/index.ts CHANGED
@@ -2,8 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { DeckPlugin } from './DeckPlugin';
6
-
7
- export default DeckPlugin;
8
-
5
+ export { DeckCapabilities } from './capabilities';
6
+ export { DeckEvents } from './events';
9
7
  export * from './DeckPlugin';
8
+ export * from './meta';
package/src/meta.ts CHANGED
@@ -4,9 +4,9 @@
4
4
 
5
5
  import { type PluginMeta } from '@dxos/app-framework';
6
6
 
7
- export const DECK_PLUGIN = 'dxos.org/plugin/deck';
7
+ export const DECK_PLUGIN = 'dxos.org/plugin/deck' as const;
8
8
 
9
- export default {
9
+ export const meta = {
10
10
  id: DECK_PLUGIN,
11
11
  name: 'Deck',
12
12
  } satisfies PluginMeta;
@@ -10,7 +10,9 @@ export default [
10
10
  [DECK_PLUGIN]: {
11
11
  'main header label': 'Main header',
12
12
  'open navigation sidebar label': 'Open navigation sidebar',
13
+ 'close navigation sidebar label': 'Minimize navigation sidebar',
13
14
  'open complementary sidebar label': 'Open sidebar',
15
+ 'close complementary sidebar label': 'Minimize sidebar',
14
16
  'plugin error message': 'Content failed to render.',
15
17
  'content fallback message': 'Unsupported',
16
18
  'content fallback description':
@@ -48,6 +50,9 @@ export default [
48
50
  'settings overscroll centering label': 'Centering',
49
51
  'settings overscroll none label': 'None',
50
52
  'settings flat deck': 'Flatten deck appearance',
53
+ 'close current label': 'Close current plank',
54
+ 'close others label': 'Close other planks',
55
+ 'close all label': 'Close all planks',
51
56
  },
52
57
  },
53
58
  },
package/src/types.ts CHANGED
@@ -2,18 +2,11 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import type {
6
- Plugin,
7
- GraphBuilderProvides,
8
- IntentResolverProvides,
9
- LayoutProvides,
10
- LocationProvides,
11
- SettingsProvides,
12
- SurfaceProvides,
13
- TranslationsProvides,
14
- } from '@dxos/app-framework';
5
+ import { S } from '@dxos/echo-schema';
15
6
  import { type Label } from '@dxos/react-ui';
16
7
 
8
+ import { DECK_PLUGIN } from './meta';
9
+
17
10
  // TODO(Zan): In the future we should consider adding new planks adjacent to the attended plank.
18
11
  export const NewPlankPositions = ['start', 'end'] as const;
19
12
  export type NewPlankPositioning = (typeof NewPlankPositions)[number];
@@ -24,30 +17,27 @@ export type Overscroll = (typeof OverscrollOptions)[number];
24
17
  // TODO(wittjosiah): Include a predicate for whether the panel is visible for the current subject.
25
18
  export type Panel = { id: string; label: Label; icon: string };
26
19
 
27
- // TODO(wittjosiah): Is this generic enough to be in the app framework?
28
- export type PanelProvides = {
29
- complementary: {
30
- panels: Panel[];
31
- };
32
- };
33
-
34
- export const parsePanelPlugin = (plugin?: Plugin) =>
35
- Array.isArray((plugin?.provides as any).complementary?.panels) ? (plugin as Plugin<PanelProvides>) : undefined;
36
-
37
- export type DeckSettingsProps = {
38
- showHints: boolean;
39
- customSlots: boolean;
40
- flatDeck: boolean;
41
- enableNativeRedirect: boolean;
42
- disableDeck: boolean;
43
- newPlankPositioning: NewPlankPositioning;
44
- overscroll: Overscroll;
45
- };
46
-
47
- export type DeckPluginProvides = SurfaceProvides &
48
- IntentResolverProvides &
49
- GraphBuilderProvides &
50
- TranslationsProvides &
51
- SettingsProvides<DeckSettingsProps> &
52
- LayoutProvides &
53
- LocationProvides;
20
+ export const DeckSettingsSchema = S.mutable(
21
+ S.Struct({
22
+ showHints: S.Boolean,
23
+ customSlots: S.Boolean,
24
+ flatDeck: S.Boolean,
25
+ enableNativeRedirect: S.Boolean,
26
+ newPlankPositioning: S.Literal(...NewPlankPositions),
27
+ overscroll: S.Literal(...OverscrollOptions),
28
+ }),
29
+ );
30
+
31
+ export type DeckSettingsProps = S.Schema.Type<typeof DeckSettingsSchema>;
32
+
33
+ export const DECK_ACTION = `${DECK_PLUGIN}/action`;
34
+
35
+ export namespace DeckAction {
36
+ export class UpdatePlankSize extends S.TaggedClass<UpdatePlankSize>()(`${DECK_ACTION}/update-plank-size`, {
37
+ input: S.Struct({
38
+ id: S.String,
39
+ size: S.Number,
40
+ }),
41
+ output: S.Void,
42
+ }) {}
43
+ }
package/src/util/index.ts CHANGED
@@ -2,6 +2,6 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- export * from './check-app-scheme';
6
5
  export * from './layout-parts';
7
6
  export * from './overscroll';
7
+ export * from './useBreakpoints';
@@ -0,0 +1,11 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { useMediaQuery } from '@dxos/react-ui';
6
+
7
+ export const useBreakpoints = () => {
8
+ const [isNotMobile] = useMediaQuery('md');
9
+ const [isDesktop] = useMediaQuery('lg');
10
+ return isDesktop ? 'desktop' : isNotMobile ? 'tablet' : 'mobile';
11
+ };
@@ -0,0 +1,15 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { useLayoutEffect, useState } from 'react';
6
+
7
+ export const useHoistStatusbar = (breakpoint: string) => {
8
+ const [safeAreaBottom, setSafeAreaBottom] = useState(Infinity);
9
+ useLayoutEffect(
10
+ () =>
11
+ setSafeAreaBottom(parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--safe-area-bottom'))),
12
+ [],
13
+ );
14
+ return Number.isFinite(safeAreaBottom) && safeAreaBottom < 1 && breakpoint === 'desktop';
15
+ };
@@ -1,7 +0,0 @@
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';\n\nexport default {\n id: DECK_PLUGIN,\n name: 'Deck',\n} satisfies PluginMeta;\n"],
5
- "mappings": ";AAMO,IAAMA,cAAc;AAE3B,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;AACR;",
6
- "names": ["DECK_PLUGIN", "id", "name"]
7
- }
@@ -1,17 +0,0 @@
1
- // packages/plugins/plugin-deck/src/types.ts
2
- var NewPlankPositions = [
3
- "start",
4
- "end"
5
- ];
6
- var OverscrollOptions = [
7
- "none",
8
- "centering"
9
- ];
10
- var parsePanelPlugin = (plugin) => Array.isArray(plugin?.provides.complementary?.panels) ? plugin : void 0;
11
-
12
- export {
13
- NewPlankPositions,
14
- OverscrollOptions,
15
- parsePanelPlugin
16
- };
17
- //# sourceMappingURL=chunk-NIRHDTX4.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport type {\n Plugin,\n GraphBuilderProvides,\n IntentResolverProvides,\n LayoutProvides,\n LocationProvides,\n SettingsProvides,\n SurfaceProvides,\n TranslationsProvides,\n} from '@dxos/app-framework';\nimport { type Label } from '@dxos/react-ui';\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\n// TODO(wittjosiah): Is this generic enough to be in the app framework?\nexport type PanelProvides = {\n complementary: {\n panels: Panel[];\n };\n};\n\nexport const parsePanelPlugin = (plugin?: Plugin) =>\n Array.isArray((plugin?.provides as any).complementary?.panels) ? (plugin as Plugin<PanelProvides>) : undefined;\n\nexport type DeckSettingsProps = {\n showHints: boolean;\n customSlots: boolean;\n flatDeck: boolean;\n enableNativeRedirect: boolean;\n disableDeck: boolean;\n newPlankPositioning: NewPlankPositioning;\n overscroll: Overscroll;\n};\n\nexport type DeckPluginProvides = SurfaceProvides &\n IntentResolverProvides &\n GraphBuilderProvides &\n TranslationsProvides &\n SettingsProvides<DeckSettingsProps> &\n LayoutProvides &\n LocationProvides;\n"],
5
- "mappings": ";AAiBO,IAAMA,oBAAoB;EAAC;EAAS;;AAGpC,IAAMC,oBAAoB;EAAC;EAAQ;;AAanC,IAAMC,mBAAmB,CAACC,WAC/BC,MAAMC,QAASF,QAAQG,SAAiBC,eAAeC,MAAAA,IAAWL,SAAmCM;",
6
- "names": ["NewPlankPositions", "OverscrollOptions", "parsePanelPlugin", "plugin", "Array", "isArray", "provides", "complementary", "panels", "undefined"]
7
- }
@@ -1,9 +0,0 @@
1
- import {
2
- DECK_PLUGIN,
3
- meta_default
4
- } from "./chunk-GVOGPULO.mjs";
5
- export {
6
- DECK_PLUGIN,
7
- meta_default as default
8
- };
9
- //# sourceMappingURL=meta.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,2 +0,0 @@
1
- export declare const checkAppScheme: (url: string) => void;
2
- //# sourceMappingURL=check-app-scheme.d.ts.map
@@ -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"}