@dxos/plugin-deck 0.8.2-main.36232bc → 0.8.2-main.5ca3450

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 (64) hide show
  1. package/dist/lib/browser/{chunk-STZ4VVW6.mjs → chunk-AHTP72DY.mjs} +28 -14
  2. package/dist/lib/browser/chunk-AHTP72DY.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-E7TOEOGO.mjs +157 -0
  4. package/dist/lib/browser/chunk-E7TOEOGO.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-6HJZL3WT.mjs → chunk-PGSJT5PG.mjs} +2 -2
  6. package/dist/lib/browser/{chunk-WFTGOFIF.mjs → chunk-RKYIMUKW.mjs} +8 -8
  7. package/dist/lib/browser/index.mjs +3 -3
  8. package/dist/lib/browser/{intent-resolver-JKWXWUV6.mjs → intent-resolver-NO6L67KF.mjs} +23 -23
  9. package/dist/lib/browser/intent-resolver-NO6L67KF.mjs.map +7 -0
  10. package/dist/lib/browser/meta.json +1 -1
  11. package/dist/lib/browser/{react-root-7JVQQA4K.mjs → react-root-5RWCIUXV.mjs} +5 -5
  12. package/dist/lib/browser/{react-surface-MQ7QJ7JJ.mjs → react-surface-DIDOPTH7.mjs} +5 -5
  13. package/dist/lib/browser/{settings-6NU7CF2B.mjs → settings-C7LX2GXF.mjs} +2 -2
  14. package/dist/lib/browser/{state-Z6UY2Z3M.mjs → state-AX74YEJD.mjs} +2 -2
  15. package/dist/lib/browser/{tools-VDVQTJMD.mjs → tools-7W7KZRAX.mjs} +7 -7
  16. package/dist/lib/browser/tools-7W7KZRAX.mjs.map +7 -0
  17. package/dist/lib/browser/types.mjs +1 -1
  18. package/dist/lib/browser/{url-handler-3CARFXQK.mjs → url-handler-AF5SYROZ.mjs} +2 -2
  19. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  20. package/dist/types/src/capabilities/check-app-scheme.d.ts.map +1 -1
  21. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  22. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  23. package/dist/types/src/capabilities/tools.d.ts.map +1 -1
  24. package/dist/types/src/capabilities/url-handler.d.ts.map +1 -1
  25. package/dist/types/src/components/DeckLayout/Banner.d.ts.map +1 -1
  26. package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
  27. package/dist/types/src/components/DeckLayout/Popover.d.ts.map +1 -1
  28. package/dist/types/src/components/DeckLayout/StatusBar.d.ts.map +1 -1
  29. package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
  30. package/dist/types/src/components/DeckSettings/DeckSettings.d.ts.map +1 -1
  31. package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
  32. package/dist/types/src/components/Plank/PlankError.d.ts.map +1 -1
  33. package/dist/types/src/components/Plank/PlankHeading.d.ts.map +1 -1
  34. package/dist/types/src/components/Sidebar/ComplementarySidebar.d.ts.map +1 -1
  35. package/dist/types/src/components/Sidebar/SidebarButton.d.ts.map +1 -1
  36. package/dist/types/src/hooks/useNodeActionExpander.d.ts.map +1 -1
  37. package/dist/types/src/layout.d.ts.map +1 -1
  38. package/dist/types/src/types.d.ts +104 -104
  39. package/dist/types/src/types.d.ts.map +1 -1
  40. package/dist/types/src/util/layoutAppliesTopbar.d.ts.map +1 -1
  41. package/dist/types/src/util/overscroll.d.ts.map +1 -1
  42. package/dist/types/src/util/set-active.d.ts.map +1 -1
  43. package/dist/types/src/util/useCompanions.d.ts.map +1 -1
  44. package/dist/types/src/util/useHoistStatusbar.d.ts.map +1 -1
  45. package/dist/types/tsconfig.tsbuildinfo +1 -1
  46. package/package.json +30 -29
  47. package/src/capabilities/intent-resolver.ts +32 -32
  48. package/src/capabilities/tools.ts +4 -3
  49. package/src/components/DeckLayout/Popover.tsx +18 -3
  50. package/src/components/Plank/Plank.tsx +3 -1
  51. package/src/components/Plank/PlankHeading.tsx +3 -0
  52. package/src/types.ts +72 -71
  53. package/dist/lib/browser/chunk-STZ4VVW6.mjs.map +0 -7
  54. package/dist/lib/browser/chunk-ZMJMCN7O.mjs +0 -157
  55. package/dist/lib/browser/chunk-ZMJMCN7O.mjs.map +0 -7
  56. package/dist/lib/browser/intent-resolver-JKWXWUV6.mjs.map +0 -7
  57. package/dist/lib/browser/tools-VDVQTJMD.mjs.map +0 -7
  58. /package/dist/lib/browser/{chunk-6HJZL3WT.mjs.map → chunk-PGSJT5PG.mjs.map} +0 -0
  59. /package/dist/lib/browser/{chunk-WFTGOFIF.mjs.map → chunk-RKYIMUKW.mjs.map} +0 -0
  60. /package/dist/lib/browser/{react-root-7JVQQA4K.mjs.map → react-root-5RWCIUXV.mjs.map} +0 -0
  61. /package/dist/lib/browser/{react-surface-MQ7QJ7JJ.mjs.map → react-surface-DIDOPTH7.mjs.map} +0 -0
  62. /package/dist/lib/browser/{settings-6NU7CF2B.mjs.map → settings-C7LX2GXF.mjs.map} +0 -0
  63. /package/dist/lib/browser/{state-Z6UY2Z3M.mjs.map → state-AX74YEJD.mjs.map} +0 -0
  64. /package/dist/lib/browser/{url-handler-3CARFXQK.mjs.map → url-handler-AF5SYROZ.mjs.map} +0 -0
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { batch } from '@preact/signals-core';
6
- import { Effect, pipe } from 'effect';
6
+ import { Schema, Effect, pipe } from 'effect';
7
7
 
8
8
  import {
9
9
  Capabilities,
@@ -15,7 +15,7 @@ import {
15
15
  createIntent,
16
16
  chain,
17
17
  } from '@dxos/app-framework';
18
- import { getTypename, S } from '@dxos/echo-schema';
18
+ import { getTypename } from '@dxos/echo-schema';
19
19
  import { invariant } from '@dxos/invariant';
20
20
  import { isLiveObject } from '@dxos/live-object';
21
21
  import { log } from '@dxos/log';
@@ -67,10 +67,10 @@ export default (context: PluginsContext) =>
67
67
  }),
68
68
  createResolver({
69
69
  intent: LayoutAction.UpdateLayout,
70
- // TODO(wittjosiah): This should be able to just be `S.is(LayoutAction.UpdateSidebar.fields.input)`
70
+ // TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.UpdateSidebar.fields.input)`
71
71
  // but the filter is not being applied correctly.
72
- filter: (data): data is S.Schema.Type<typeof LayoutAction.UpdateSidebar.fields.input> =>
73
- S.is(LayoutAction.UpdateSidebar.fields.input)(data),
72
+ filter: (data): data is Schema.Schema.Type<typeof LayoutAction.UpdateSidebar.fields.input> =>
73
+ Schema.is(LayoutAction.UpdateSidebar.fields.input)(data),
74
74
  resolve: ({ options }) => {
75
75
  const layout = context.requestCapability(DeckCapabilities.MutableDeckState);
76
76
  const next = options?.state ?? layout.sidebarState;
@@ -81,10 +81,10 @@ export default (context: PluginsContext) =>
81
81
  }),
82
82
  createResolver({
83
83
  intent: LayoutAction.UpdateLayout,
84
- // TODO(wittjosiah): This should be able to just be `S.is(LayoutAction.UpdateComplementary.fields.input)`
84
+ // TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.UpdateComplementary.fields.input)`
85
85
  // but the filter is not being applied correctly.
86
- filter: (data): data is S.Schema.Type<typeof LayoutAction.UpdateComplementary.fields.input> =>
87
- S.is(LayoutAction.UpdateComplementary.fields.input)(data),
86
+ filter: (data): data is Schema.Schema.Type<typeof LayoutAction.UpdateComplementary.fields.input> =>
87
+ Schema.is(LayoutAction.UpdateComplementary.fields.input)(data),
88
88
  resolve: ({ subject, options }) => {
89
89
  const layout = context.requestCapability(DeckCapabilities.MutableDeckState);
90
90
 
@@ -100,10 +100,10 @@ export default (context: PluginsContext) =>
100
100
  }),
101
101
  createResolver({
102
102
  intent: LayoutAction.UpdateLayout,
103
- // TODO(wittjosiah): This should be able to just be `S.is(LayoutAction.UpdateDialog.fields.input)`
103
+ // TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.UpdateDialog.fields.input)`
104
104
  // but the filter is not being applied correctly.
105
- filter: (data): data is S.Schema.Type<typeof LayoutAction.UpdateDialog.fields.input> =>
106
- S.is(LayoutAction.UpdateDialog.fields.input)(data),
105
+ filter: (data): data is Schema.Schema.Type<typeof LayoutAction.UpdateDialog.fields.input> =>
106
+ Schema.is(LayoutAction.UpdateDialog.fields.input)(data),
107
107
  resolve: ({ subject, options }) => {
108
108
  const layout = context.requestCapability(DeckCapabilities.MutableDeckState);
109
109
  layout.dialogOpen = options.state ?? Boolean(subject);
@@ -114,10 +114,10 @@ export default (context: PluginsContext) =>
114
114
  }),
115
115
  createResolver({
116
116
  intent: LayoutAction.UpdateLayout,
117
- // TODO(wittjosiah): This should be able to just be `S.is(LayoutAction.UpdatePopover.fields.input)`
117
+ // TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.UpdatePopover.fields.input)`
118
118
  // but the filter is not being applied correctly.
119
- filter: (data): data is S.Schema.Type<typeof LayoutAction.UpdatePopover.fields.input> =>
120
- S.is(LayoutAction.UpdatePopover.fields.input)(data),
119
+ filter: (data): data is Schema.Schema.Type<typeof LayoutAction.UpdatePopover.fields.input> =>
120
+ Schema.is(LayoutAction.UpdatePopover.fields.input)(data),
121
121
  resolve: ({ subject, options }) => {
122
122
  const layout = context.requestCapability(DeckCapabilities.MutableDeckState);
123
123
  layout.popoverOpen = options.state ?? Boolean(subject);
@@ -133,10 +133,10 @@ export default (context: PluginsContext) =>
133
133
  }),
134
134
  createResolver({
135
135
  intent: LayoutAction.UpdateLayout,
136
- // TODO(wittjosiah): This should be able to just be `S.is(LayoutAction.AddToast.fields.input)`
136
+ // TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.AddToast.fields.input)`
137
137
  // but the filter is not being applied correctly.
138
- filter: (data): data is S.Schema.Type<typeof LayoutAction.AddToast.fields.input> =>
139
- S.is(LayoutAction.AddToast.fields.input)(data),
138
+ filter: (data): data is Schema.Schema.Type<typeof LayoutAction.AddToast.fields.input> =>
139
+ Schema.is(LayoutAction.AddToast.fields.input)(data),
140
140
  resolve: ({ subject }) => {
141
141
  const layout = context.requestCapability(DeckCapabilities.MutableDeckState);
142
142
  layout.toasts.push(subject);
@@ -144,10 +144,10 @@ export default (context: PluginsContext) =>
144
144
  }),
145
145
  createResolver({
146
146
  intent: LayoutAction.UpdateLayout,
147
- // TODO(wittjosiah): This should be able to just be `S.is(LayoutAction.SetLayoutMode.fields.input)`
147
+ // TODO(wittjosiah): This should be able to just be `Schema.is(LayoutAction.SetLayoutMode.fields.input)`
148
148
  // but the filter is not being applied correctly.
149
- filter: (data): data is S.Schema.Type<typeof LayoutAction.SetLayoutMode.fields.input> => {
150
- if (!S.is(LayoutAction.SetLayoutMode.fields.input)(data)) {
149
+ filter: (data): data is Schema.Schema.Type<typeof LayoutAction.SetLayoutMode.fields.input> => {
150
+ if (!Schema.is(LayoutAction.SetLayoutMode.fields.input)(data)) {
151
151
  return false;
152
152
  }
153
153
 
@@ -202,8 +202,8 @@ export default (context: PluginsContext) =>
202
202
  }),
203
203
  createResolver({
204
204
  intent: LayoutAction.UpdateLayout,
205
- filter: (data): data is S.Schema.Type<typeof LayoutAction.SwitchWorkspace.fields.input> =>
206
- S.is(LayoutAction.SwitchWorkspace.fields.input)(data),
205
+ filter: (data): data is Schema.Schema.Type<typeof LayoutAction.SwitchWorkspace.fields.input> =>
206
+ Schema.is(LayoutAction.SwitchWorkspace.fields.input)(data),
207
207
  resolve: ({ subject }) => {
208
208
  const state = context.requestCapability(DeckCapabilities.MutableDeckState);
209
209
  batch(() => {
@@ -228,8 +228,8 @@ export default (context: PluginsContext) =>
228
228
  }),
229
229
  createResolver({
230
230
  intent: LayoutAction.UpdateLayout,
231
- filter: (data): data is S.Schema.Type<typeof LayoutAction.RevertWorkspace.fields.input> =>
232
- S.is(LayoutAction.RevertWorkspace.fields.input)(data),
231
+ filter: (data): data is Schema.Schema.Type<typeof LayoutAction.RevertWorkspace.fields.input> =>
232
+ Schema.is(LayoutAction.RevertWorkspace.fields.input)(data),
233
233
  resolve: () => {
234
234
  const state = context.requestCapability(DeckCapabilities.MutableDeckState);
235
235
  return {
@@ -239,8 +239,8 @@ export default (context: PluginsContext) =>
239
239
  }),
240
240
  createResolver({
241
241
  intent: LayoutAction.UpdateLayout,
242
- filter: (data): data is S.Schema.Type<typeof LayoutAction.Open.fields.input> =>
243
- S.is(LayoutAction.Open.fields.input)(data),
242
+ filter: (data): data is Schema.Schema.Type<typeof LayoutAction.Open.fields.input> =>
243
+ Schema.is(LayoutAction.Open.fields.input)(data),
244
244
  resolve: ({ subject, options }) =>
245
245
  Effect.gen(function* () {
246
246
  const { graph } = context.requestCapability(Capabilities.AppGraph);
@@ -301,8 +301,8 @@ export default (context: PluginsContext) =>
301
301
  }),
302
302
  createResolver({
303
303
  intent: LayoutAction.UpdateLayout,
304
- filter: (data): data is S.Schema.Type<typeof LayoutAction.Close.fields.input> =>
305
- S.is(LayoutAction.Close.fields.input)(data),
304
+ filter: (data): data is Schema.Schema.Type<typeof LayoutAction.Close.fields.input> =>
305
+ Schema.is(LayoutAction.Close.fields.input)(data),
306
306
  resolve: ({ subject }) => {
307
307
  const state = context.requestCapability(DeckCapabilities.MutableDeckState);
308
308
  const attention = context.requestCapability(AttentionCapabilities.Attention);
@@ -324,8 +324,8 @@ export default (context: PluginsContext) =>
324
324
  }),
325
325
  createResolver({
326
326
  intent: LayoutAction.UpdateLayout,
327
- filter: (data): data is S.Schema.Type<typeof LayoutAction.Set.fields.input> =>
328
- S.is(LayoutAction.Set.fields.input)(data),
327
+ filter: (data): data is Schema.Schema.Type<typeof LayoutAction.Set.fields.input> =>
328
+ Schema.is(LayoutAction.Set.fields.input)(data),
329
329
  resolve: ({ subject }) => {
330
330
  const state = context.requestCapability(DeckCapabilities.MutableDeckState);
331
331
  const attention = context.requestCapability(AttentionCapabilities.Attention);
@@ -337,8 +337,8 @@ export default (context: PluginsContext) =>
337
337
  }),
338
338
  createResolver({
339
339
  intent: LayoutAction.UpdateLayout,
340
- filter: (data): data is S.Schema.Type<typeof LayoutAction.ScrollIntoView.fields.input> =>
341
- S.is(LayoutAction.ScrollIntoView.fields.input)(data),
340
+ filter: (data): data is Schema.Schema.Type<typeof LayoutAction.ScrollIntoView.fields.input> =>
341
+ Schema.is(LayoutAction.ScrollIntoView.fields.input)(data),
342
342
  resolve: ({ subject }) => {
343
343
  const layout = context.requestCapability(DeckCapabilities.MutableDeckState);
344
344
  layout.scrollIntoView = subject;
@@ -2,6 +2,8 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ import { Schema } from 'effect';
6
+
5
7
  import {
6
8
  contributes,
7
9
  createIntent,
@@ -10,7 +12,6 @@ import {
10
12
  type PromiseIntentDispatcher,
11
13
  } from '@dxos/app-framework';
12
14
  import { defineTool, ToolResult } from '@dxos/artifact';
13
- import { S } from '@dxos/echo-schema';
14
15
  import { invariant } from '@dxos/invariant';
15
16
 
16
17
  import { meta } from '../meta';
@@ -35,8 +36,8 @@ export default () =>
35
36
  `,
36
37
  caption: 'Showing item...',
37
38
  // TODO(wittjosiah): Refactor Layout/Navigation/Deck actions so that they can be used directly.
38
- schema: S.Struct({
39
- id: S.String.annotations({
39
+ schema: Schema.Struct({
40
+ id: Schema.String.annotations({
40
41
  description: 'The ID of the item to show.',
41
42
  }),
42
43
  }),
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { createContext } from '@radix-ui/react-context';
6
- import React, { type PropsWithChildren, useCallback, useEffect, useRef, useState } from 'react';
6
+ import React, { type PropsWithChildren, useCallback, useEffect, useMemo, useRef, useState } from 'react';
7
7
 
8
8
  import { Surface, useCapability } from '@dxos/app-framework';
9
9
  import { Popover, type PopoverContentInteractOutsideEvent } from '@dxos/react-ui';
@@ -45,7 +45,7 @@ export const PopoverRoot = ({ children }: DeckPopoverRootProps) => {
45
45
 
46
46
  return (
47
47
  <DeckPopoverProvider setOpen={setOpen}>
48
- <Popover.Root modal open={open}>
48
+ <Popover.Root modal={false} open={open}>
49
49
  {layout.popoverAnchor && <Popover.VirtualTrigger key={virtualIter} virtualRef={virtualRef} />}
50
50
  {children}
51
51
  </Popover.Root>
@@ -76,9 +76,24 @@ export const PopoverContent = () => {
76
76
  [setOpen],
77
77
  );
78
78
 
79
+ const collisionBoundaries: HTMLElement[] = useMemo(() => {
80
+ const closest = layout.popoverAnchor?.closest('[data-popover-collision-boundary]') as
81
+ | HTMLElement
82
+ | null
83
+ | undefined;
84
+ return closest ? [closest] : [];
85
+ }, [layout.popoverAnchor]);
86
+
79
87
  return (
80
88
  <Popover.Portal>
81
- <Popover.Content side={layout.popoverSide} onInteractOutside={handleClose} onEscapeKeyDown={handleClose}>
89
+ <Popover.Content
90
+ side={layout.popoverSide}
91
+ onInteractOutside={handleClose}
92
+ onEscapeKeyDown={handleClose}
93
+ collisionBoundary={collisionBoundaries}
94
+ sticky='always'
95
+ hideWhenDetached
96
+ >
82
97
  <Popover.Viewport>
83
98
  <Surface role='popover' data={layout.popoverContent} limit={1} />
84
99
  </Popover.Viewport>
@@ -116,7 +116,7 @@ const PlankImpl = memo(
116
116
  path,
117
117
  popoverAnchorId,
118
118
  },
119
- [node, node?.data, path, popoverAnchorId, primary?.data],
119
+ [node, node?.data, path, popoverAnchorId, primary?.data, variant],
120
120
  );
121
121
 
122
122
  // TODO(wittjosiah): Change prop to accept a component.
@@ -131,6 +131,8 @@ const PlankImpl = memo(
131
131
  part === 'deck' && (companioned === 'companion' ? '!border-separator border-ie' : '!border-separator border-li'),
132
132
  part.startsWith('solo-') && 'row-span-2 grid-rows-subgrid min-is-0',
133
133
  part === 'solo-companion' && '!border-separator border-is',
134
+ layoutMode === 'solo--fullscreen' &&
135
+ '!transition-[margin-block-start,inline-size] -mbs-[--rail-action] has-[[data-plank-heading]:hover]:mbs-0',
134
136
  );
135
137
 
136
138
  return (
@@ -145,7 +145,10 @@ export const PlankHeading = memo(
145
145
  classNames={[
146
146
  'plb-1 border-be border-separator items-stretch gap-1 sticky inline-start-12 app-drag min-is-0 contain-layout',
147
147
  part === 'solo' ? soloInlinePadding : 'pli-1',
148
+ layoutMode === 'solo--fullscreen' &&
149
+ 'opacity-0 border-transparent hover:border-separator hover:opacity-100 transition-[border-color,opacity]',
148
150
  ]}
151
+ data-plank-heading
149
152
  >
150
153
  {companions && isCompanionNode ? (
151
154
  <div role='none' className='flex-1 min-is-0 overflow-x-auto scrollbar-thin flex gap-1'>
package/src/types.ts CHANGED
@@ -2,8 +2,9 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
+ import { Schema } from 'effect';
6
+
5
7
  import { LayoutAction } from '@dxos/app-framework';
6
- import { S } from '@dxos/echo-schema';
7
8
  import { type DeepReadonly } from '@dxos/util';
8
9
 
9
10
  import { DECK_PLUGIN } from './meta';
@@ -23,33 +24,33 @@ export type Overscroll = (typeof OverscrollOptions)[number];
23
24
  export type Part = 'solo' | 'deck' | 'complementary';
24
25
  export type ResolvedPart = Part | 'solo-primary' | 'solo-companion';
25
26
 
26
- export const DeckSettingsSchema = S.Struct({
27
- showHints: S.optional(S.Boolean),
28
- enableDeck: S.optional(S.Boolean),
29
- enableNativeRedirect: S.optional(S.Boolean),
30
- enableStatusbar: S.optional(S.Boolean),
31
- newPlankPositioning: S.optional(S.Literal(...NewPlankPositions)),
32
- overscroll: S.optional(S.Literal(...OverscrollOptions)),
33
- }).pipe(S.mutable);
34
- export type DeckSettingsProps = S.Schema.Type<typeof DeckSettingsSchema>;
27
+ export const DeckSettingsSchema = Schema.Struct({
28
+ showHints: Schema.optional(Schema.Boolean),
29
+ enableDeck: Schema.optional(Schema.Boolean),
30
+ enableNativeRedirect: Schema.optional(Schema.Boolean),
31
+ enableStatusbar: Schema.optional(Schema.Boolean),
32
+ newPlankPositioning: Schema.optional(Schema.Literal(...NewPlankPositions)),
33
+ overscroll: Schema.optional(Schema.Literal(...OverscrollOptions)),
34
+ }).pipe(Schema.mutable);
35
+ export type DeckSettingsProps = Schema.Schema.Type<typeof DeckSettingsSchema>;
35
36
 
36
- export const PlankSizing = S.Record({ key: S.String, value: S.Number });
37
- export type PlankSizing = S.Schema.Type<typeof PlankSizing>;
37
+ export const PlankSizing = Schema.Record({ key: Schema.String, value: Schema.Number });
38
+ export type PlankSizing = Schema.Schema.Type<typeof PlankSizing>;
38
39
 
39
40
  // State of an individual deck.
40
- export const DeckState = S.Struct({
41
+ export const DeckState = Schema.Struct({
41
42
  /** If false, the deck has not yet left solo mode and new planks should be soloed. */
42
- initialized: S.Boolean,
43
- active: S.mutable(S.Array(S.String)),
43
+ initialized: Schema.Boolean,
44
+ active: Schema.mutable(Schema.Array(Schema.String)),
44
45
  // TODO(wittjosiah): Piping into both mutable and optional caused invalid typescript output.
45
- activeCompanions: S.optional(S.mutable(S.Record({ key: S.String, value: S.String }))),
46
- inactive: S.mutable(S.Array(S.String)),
47
- solo: S.optional(S.String),
48
- fullscreen: S.Boolean,
49
- plankSizing: S.mutable(PlankSizing),
50
- companionFrameSizing: S.mutable(PlankSizing),
46
+ activeCompanions: Schema.optional(Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.String }))),
47
+ inactive: Schema.mutable(Schema.Array(Schema.String)),
48
+ solo: Schema.optional(Schema.String),
49
+ fullscreen: Schema.Boolean,
50
+ plankSizing: Schema.mutable(PlankSizing),
51
+ companionFrameSizing: Schema.mutable(PlankSizing),
51
52
  });
52
- export type DeckState = S.Schema.Type<typeof DeckState>;
53
+ export type DeckState = Schema.Schema.Type<typeof DeckState>;
53
54
 
54
55
  export const defaultDeck: DeckState = {
55
56
  initialized: false,
@@ -62,9 +63,9 @@ export const defaultDeck: DeckState = {
62
63
  companionFrameSizing: {},
63
64
  };
64
65
 
65
- const LayoutMode = S.Literal('deck', 'solo', 'solo--fullscreen');
66
- export type LayoutMode = S.Schema.Type<typeof LayoutMode>;
67
- export const isLayoutMode = (value: any): value is LayoutMode => S.is(LayoutMode)(value);
66
+ const LayoutMode = Schema.Literal('deck', 'solo', 'solo--fullscreen');
67
+ export type LayoutMode = Schema.Schema.Type<typeof LayoutMode>;
68
+ export const isLayoutMode = (value: any): value is LayoutMode => Schema.is(LayoutMode)(value);
68
69
 
69
70
  export const getMode = (deck: DeckState | DeepReadonly<DeckState>): LayoutMode => {
70
71
  if (deck.solo) {
@@ -75,73 +76,73 @@ export const getMode = (deck: DeckState | DeepReadonly<DeckState>): LayoutMode =
75
76
  };
76
77
 
77
78
  // State of the deck plugin.
78
- export const DeckPluginState = S.Struct({
79
- sidebarState: S.Literal('closed', 'collapsed', 'expanded'),
80
- complementarySidebarState: S.Literal('closed', 'collapsed', 'expanded'),
81
- complementarySidebarPanel: S.optional(S.String),
82
-
83
- dialogOpen: S.Boolean,
84
- dialogBlockAlign: S.optional(S.Literal('start', 'center', 'end')),
85
- dialogType: S.optional(S.Literal('default', 'alert')),
79
+ export const DeckPluginState = Schema.Struct({
80
+ sidebarState: Schema.Literal('closed', 'collapsed', 'expanded'),
81
+ complementarySidebarState: Schema.Literal('closed', 'collapsed', 'expanded'),
82
+ complementarySidebarPanel: Schema.optional(Schema.String),
83
+
84
+ dialogOpen: Schema.Boolean,
85
+ dialogBlockAlign: Schema.optional(Schema.Literal('start', 'center', 'end')),
86
+ dialogType: Schema.optional(Schema.Literal('default', 'alert')),
86
87
  /** Data to be passed to the dialog Surface. */
87
- dialogContent: S.optional(S.Any),
88
+ dialogContent: Schema.optional(Schema.Any),
88
89
 
89
- popoverOpen: S.Boolean,
90
- popoverSide: S.optional(S.Literal('top', 'right', 'bottom', 'left')),
91
- popoverAnchor: S.optional(S.Any),
92
- popoverAnchorId: S.optional(S.String),
90
+ popoverOpen: Schema.Boolean,
91
+ popoverSide: Schema.optional(Schema.Literal('top', 'right', 'bottom', 'left')),
92
+ popoverAnchor: Schema.optional(Schema.Any),
93
+ popoverAnchorId: Schema.optional(Schema.String),
93
94
  /** Data to be passed to the popover Surface. */
94
- popoverContent: S.optional(S.Any),
95
+ popoverContent: Schema.optional(Schema.Any),
95
96
 
96
- toasts: S.mutable(S.Array(LayoutAction.Toast)),
97
- currentUndoId: S.optional(S.String),
97
+ toasts: Schema.mutable(Schema.Array(LayoutAction.Toast)),
98
+ currentUndoId: Schema.optional(Schema.String),
98
99
 
99
- activeDeck: S.String,
100
- previousDeck: S.String,
101
- decks: S.mutable(S.Record({ key: S.String, value: S.mutable(DeckState) })),
102
- previousMode: S.mutable(S.Record({ key: S.String, value: LayoutMode })),
103
- deck: S.mutable(DeckState),
100
+ activeDeck: Schema.String,
101
+ previousDeck: Schema.String,
102
+ decks: Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.mutable(DeckState) })),
103
+ previousMode: Schema.mutable(Schema.Record({ key: Schema.String, value: LayoutMode })),
104
+ deck: Schema.mutable(DeckState),
104
105
 
105
106
  /** The identifier of a component to scroll into view when it is mounted. */
106
- scrollIntoView: S.optional(S.String),
107
- }).pipe(S.mutable);
107
+ scrollIntoView: Schema.optional(Schema.String),
108
+ }).pipe(Schema.mutable);
108
109
 
109
- export type DeckPluginState = S.Schema.Type<typeof DeckPluginState>;
110
+ export type DeckPluginState = Schema.Schema.Type<typeof DeckPluginState>;
110
111
 
111
112
  export const DECK_ACTION = `${DECK_PLUGIN}/action`;
112
113
 
113
114
  export namespace DeckAction {
114
- const PartAdjustmentSchema = S.Union(
115
- S.Literal('close').annotations({ description: 'Close the plank.' }),
116
- S.Literal('companion').annotations({ description: 'Open the companion plank.' }),
117
- S.Literal('solo').annotations({ description: 'Solo the plank.' }),
118
- S.Literal('solo--fullscreen').annotations({ description: 'Fullscreen the plank.' }),
119
- S.Literal('increment-start').annotations({ description: 'Move the plank towards the start of the deck.' }),
120
- S.Literal('increment-end').annotations({ description: 'Move the plank towards the end of the deck.' }),
115
+ const PartAdjustmentSchema = Schema.Union(
116
+ Schema.Literal('close').annotations({ description: 'Close the plank.' }),
117
+ Schema.Literal('companion').annotations({ description: 'Open the companion plank.' }),
118
+ Schema.Literal('solo').annotations({ description: 'Solo the plank.' }),
119
+ Schema.Literal('solo--fullscreen').annotations({ description: 'Fullscreen the plank.' }),
120
+ Schema.Literal('increment-start').annotations({ description: 'Move the plank towards the start of the deck.' }),
121
+ Schema.Literal('increment-end').annotations({ description: 'Move the plank towards the end of the deck.' }),
121
122
  );
122
- export type PartAdjustment = S.Schema.Type<typeof PartAdjustmentSchema>;
123
- export const Adjustment = S.mutable(S.Struct({ id: S.String, type: PartAdjustmentSchema }));
124
- export type Adjustment = S.Schema.Type<typeof Adjustment>;
123
+ export type PartAdjustment = Schema.Schema.Type<typeof PartAdjustmentSchema>;
124
+ export const Adjustment = Schema.mutable(Schema.Struct({ id: Schema.String, type: PartAdjustmentSchema }));
125
+ export type Adjustment = Schema.Schema.Type<typeof Adjustment>;
125
126
 
126
127
  // An atomic transaction to apply to the deck, describing which element to move to which location.
127
- export class Adjust extends S.TaggedClass<Adjust>()(`${DECK_ACTION}/adjust`, {
128
+ export class Adjust extends Schema.TaggedClass<Adjust>()(`${DECK_ACTION}/adjust`, {
128
129
  input: Adjustment,
129
- output: S.Void,
130
+ output: Schema.Void,
130
131
  }) {}
131
132
 
132
- export class UpdatePlankSize extends S.TaggedClass<UpdatePlankSize>()(`${DECK_ACTION}/update-plank-size`, {
133
- input: S.Struct({
134
- id: S.String,
135
- size: S.Number,
133
+ export class UpdatePlankSize extends Schema.TaggedClass<UpdatePlankSize>()(`${DECK_ACTION}/update-plank-size`, {
134
+ input: Schema.Struct({
135
+ id: Schema.String,
136
+ size: Schema.Number,
136
137
  }),
137
- output: S.Void,
138
+ output: Schema.Void,
138
139
  }) {}
139
140
 
140
- export class ChangeCompanion extends S.TaggedClass<ChangeCompanion>()(`${DECK_ACTION}/change-companion`, {
141
- input: S.Struct({
142
- primary: S.String,
143
- companion: S.Union(S.String, S.Null),
141
+ export class ChangeCompanion extends Schema.TaggedClass<ChangeCompanion>()(`${DECK_ACTION}/change-companion`, {
142
+ input: Schema.Struct({
143
+ primary: Schema.String,
144
+ companion: Schema.Union(Schema.String, Schema.Null),
144
145
  }),
145
- output: S.Void,
146
+ output: Schema.Void,
146
147
  }) {}
147
148
  }