@dxos/react-ui-mosaic 0.3.9-main.cea1d3b → 0.3.9-main.d4ef8aa

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 (63) hide show
  1. package/dist/lib/browser/index.mjs +45 -451
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/types/src/index.d.ts +0 -1
  5. package/dist/types/src/index.d.ts.map +1 -1
  6. package/dist/types/src/mosaic/Container.d.ts +14 -4
  7. package/dist/types/src/mosaic/Container.d.ts.map +1 -1
  8. package/dist/types/src/mosaic/DragOverlay.d.ts.map +1 -1
  9. package/dist/types/src/mosaic/Tile.d.ts +9 -7
  10. package/dist/types/src/mosaic/Tile.d.ts.map +1 -1
  11. package/dist/types/src/mosaic/hooks/useContainer.d.ts +2 -2
  12. package/dist/types/src/mosaic/hooks/useContainer.d.ts.map +1 -1
  13. package/dist/types/src/mosaic/types.d.ts +1 -0
  14. package/dist/types/src/mosaic/types.d.ts.map +1 -1
  15. package/dist/types/src/mosaic/util/index.d.ts +1 -0
  16. package/dist/types/src/mosaic/util/index.d.ts.map +1 -1
  17. package/dist/types/src/mosaic/util/props.d.ts +4 -0
  18. package/dist/types/src/mosaic/util/props.d.ts.map +1 -0
  19. package/dist/types/src/stories/Home.stories.d.ts +1 -1
  20. package/dist/types/src/stories/Home.stories.d.ts.map +1 -1
  21. package/dist/types/src/views/Demo/Demo.stories.d.ts +1 -1
  22. package/dist/types/src/views/Demo/Demo.stories.d.ts.map +1 -1
  23. package/dist/types/src/views/Demo/Echo.stories.d.ts +1 -1
  24. package/dist/types/src/views/Demo/Echo.stories.d.ts.map +1 -1
  25. package/dist/types/src/views/Grid/Grid.stories.d.ts +1 -1
  26. package/dist/types/src/views/Grid/Grid.stories.d.ts.map +1 -1
  27. package/dist/types/src/views/Kanban/Echo.stories.d.ts +1 -1
  28. package/dist/types/src/views/Kanban/Echo.stories.d.ts.map +1 -1
  29. package/dist/types/src/views/Kanban/Kanban.stories.d.ts +1 -1
  30. package/dist/types/src/views/Kanban/Kanban.stories.d.ts.map +1 -1
  31. package/dist/types/src/views/Stack/Columns.stories.d.ts +1 -1
  32. package/dist/types/src/views/Stack/Columns.stories.d.ts.map +1 -1
  33. package/dist/types/src/views/Stack/Stack.stories.d.ts +1 -1
  34. package/dist/types/src/views/Stack/Stack.stories.d.ts.map +1 -1
  35. package/dist/types/src/views/Tree/Graph.stories.d.ts +1 -1
  36. package/dist/types/src/views/Tree/Graph.stories.d.ts.map +1 -1
  37. package/dist/types/src/views/Tree/Tree.d.ts.map +1 -1
  38. package/dist/types/src/views/Tree/Tree.stories.d.ts +1 -1
  39. package/dist/types/src/views/Tree/Tree.stories.d.ts.map +1 -1
  40. package/package.json +14 -16
  41. package/src/index.ts +0 -3
  42. package/src/mosaic/Container.tsx +23 -3
  43. package/src/mosaic/DefaultComponent.tsx +1 -1
  44. package/src/mosaic/DragOverlay.tsx +1 -0
  45. package/src/mosaic/Root.tsx +4 -2
  46. package/src/mosaic/Tile.tsx +18 -7
  47. package/src/mosaic/hooks/useContainer.ts +2 -5
  48. package/src/mosaic/types.ts +2 -0
  49. package/src/mosaic/util/index.ts +1 -0
  50. package/src/mosaic/util/props.ts +14 -0
  51. package/src/stories/Home.stories.tsx +3 -1
  52. package/src/testing/Cards.tsx +1 -1
  53. package/src/views/Demo/Demo.stories.tsx +3 -1
  54. package/src/views/Demo/Echo.stories.tsx +2 -0
  55. package/src/views/Grid/Grid.stories.tsx +3 -1
  56. package/src/views/Kanban/Echo.stories.tsx +2 -0
  57. package/src/views/Kanban/Kanban.stories.tsx +3 -1
  58. package/src/views/Kanban/Kanban.tsx +1 -1
  59. package/src/views/Stack/Columns.stories.tsx +3 -1
  60. package/src/views/Stack/Stack.stories.tsx +3 -1
  61. package/src/views/Tree/Graph.stories.tsx +3 -1
  62. package/src/views/Tree/Tree.stories.tsx +3 -1
  63. package/src/views/Tree/Tree.tsx +2 -1
@@ -0,0 +1,14 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { MosaicOperations } from '../Container';
6
+ import { type MosaicTileComponentProps, type MosaicTileProps } from '../Tile';
7
+
8
+ export const isTileProps = (props: Record<string, unknown>): props is MosaicTileProps =>
9
+ typeof props.path === 'string' && typeof props.item === 'object' && props.item
10
+ ? 'id' in props.item && typeof props.item.id === 'string'
11
+ : false;
12
+
13
+ export const isTileComponentProps = (props: Record<string, unknown>): props is MosaicTileComponentProps =>
14
+ isTileProps(props) && typeof props.operation === 'string' && MosaicOperations.includes(props.operation);
@@ -6,6 +6,8 @@ import '@dxosTheme';
6
6
 
7
7
  import React from 'react';
8
8
 
9
+ import { withTheme } from '@dxos/storybook-utils';
10
+
9
11
  import { FullscreenDecorator } from '../testing';
10
12
 
11
13
  const org = '@dxos-mosaic';
@@ -78,7 +80,7 @@ const Home = () => {
78
80
 
79
81
  export default {
80
82
  component: Home,
81
- decorators: [FullscreenDecorator('flex justify-center bg-[url(/images/bg-mosaic.png)]')],
83
+ decorators: [withTheme, FullscreenDecorator('flex justify-center bg-[url(/images/bg-mosaic.png)]')],
82
84
  parameters: {
83
85
  layout: 'fullscreen',
84
86
  },
@@ -4,7 +4,7 @@
4
4
 
5
5
  import React, { forwardRef } from 'react';
6
6
 
7
- import { Card } from '@dxos/react-ui';
7
+ import { Card } from '@dxos/react-ui-card';
8
8
  import { mx } from '@dxos/react-ui-theme';
9
9
 
10
10
  import { Mosaic, type MosaicTileComponent } from '../mosaic';
@@ -7,6 +7,8 @@ import '@dxosTheme';
7
7
  import { faker } from '@faker-js/faker';
8
8
  import React from 'react';
9
9
 
10
+ import { withTheme } from '@dxos/storybook-utils';
11
+
10
12
  import { Mosaic } from '../../mosaic';
11
13
  import { ComplexCard, FullscreenDecorator, SimpleCard } from '../../testing';
12
14
  import { DemoGrid } from '../Grid/testing';
@@ -18,7 +20,7 @@ faker.seed(5);
18
20
 
19
21
  export default {
20
22
  title: 'Views/Demo',
21
- decorators: [FullscreenDecorator()],
23
+ decorators: [withTheme, FullscreenDecorator()],
22
24
  parameters: {
23
25
  layout: 'fullscreen',
24
26
  },
@@ -8,6 +8,7 @@ import React, { type FC } from 'react';
8
8
  import { type PublicKey } from '@dxos/react-client';
9
9
  import { Expando } from '@dxos/react-client/echo';
10
10
  import { ClientSpaceDecorator } from '@dxos/react-client/testing';
11
+ import { withTheme } from '@dxos/storybook-utils';
11
12
 
12
13
  import { Mosaic } from '../../mosaic';
13
14
  import { FullscreenDecorator, TestObjectGenerator, range, Status, Priority } from '../../testing';
@@ -44,6 +45,7 @@ export default {
44
45
  title: 'Views/Demo',
45
46
  render: Story,
46
47
  decorators: [
48
+ withTheme,
47
49
  FullscreenDecorator(),
48
50
  ClientSpaceDecorator({
49
51
  onCreateSpace: async (space) => {
@@ -7,6 +7,8 @@ import '@dxosTheme';
7
7
  import { faker } from '@faker-js/faker';
8
8
  import React from 'react';
9
9
 
10
+ import { withTheme } from '@dxos/storybook-utils';
11
+
10
12
  import { Grid, type GridLayout } from './Grid';
11
13
  import { DemoGrid } from './testing';
12
14
  import { Mosaic } from '../../mosaic';
@@ -39,7 +41,7 @@ export default {
39
41
  </Mosaic.Root>
40
42
  );
41
43
  },
42
- decorators: [FullscreenDecorator()],
44
+ decorators: [withTheme, FullscreenDecorator()],
43
45
  parameters: {
44
46
  layout: 'fullscreen',
45
47
  },
@@ -7,6 +7,7 @@ import React from 'react';
7
7
  import { type PublicKey } from '@dxos/react-client';
8
8
  import { Expando } from '@dxos/react-client/echo';
9
9
  import { ClientSpaceDecorator } from '@dxos/react-client/testing';
10
+ import { withTheme } from '@dxos/storybook-utils';
10
11
 
11
12
  import { Kanban } from './Kanban';
12
13
  import { EchoKanban, columnValues } from './testing';
@@ -36,6 +37,7 @@ export default {
36
37
  );
37
38
  },
38
39
  decorators: [
40
+ withTheme,
39
41
  FullscreenDecorator(),
40
42
  ClientSpaceDecorator({
41
43
  onCreateSpace: async (space) => {
@@ -7,6 +7,8 @@ import '@dxosTheme';
7
7
  import { faker } from '@faker-js/faker';
8
8
  import React from 'react';
9
9
 
10
+ import { withTheme } from '@dxos/storybook-utils';
11
+
10
12
  import { Kanban } from './Kanban';
11
13
  import { DemoKanban, type DemoKanbanProps } from './testing';
12
14
  import { Mosaic } from '../../mosaic';
@@ -24,7 +26,7 @@ export default {
24
26
  </Mosaic.Root>
25
27
  );
26
28
  },
27
- decorators: [FullscreenDecorator()],
29
+ decorators: [withTheme, FullscreenDecorator()],
28
30
  parameters: {
29
31
  layout: 'fullscreen',
30
32
  },
@@ -4,7 +4,7 @@
4
4
 
5
5
  import React, { forwardRef, useMemo } from 'react';
6
6
 
7
- import { Card } from '@dxos/react-ui';
7
+ import { Card } from '@dxos/react-ui-card';
8
8
  import { groupSurface, mx } from '@dxos/react-ui-theme';
9
9
 
10
10
  import {
@@ -7,6 +7,8 @@ import '@dxosTheme';
7
7
  import { faker } from '@faker-js/faker';
8
8
  import React from 'react';
9
9
 
10
+ import { withTheme } from '@dxos/storybook-utils';
11
+
10
12
  import { Stack } from './Stack';
11
13
  import { DemoStack, type DemoStackProps } from './testing';
12
14
  import { Mosaic } from '../../mosaic';
@@ -30,7 +32,7 @@ export default {
30
32
  </Mosaic.Root>
31
33
  );
32
34
  },
33
- decorators: [FullscreenDecorator()],
35
+ decorators: [withTheme, FullscreenDecorator()],
34
36
  parameters: {
35
37
  layout: 'fullscreen',
36
38
  },
@@ -7,6 +7,8 @@ import '@dxosTheme';
7
7
  import { faker } from '@faker-js/faker';
8
8
  import React from 'react';
9
9
 
10
+ import { withTheme } from '@dxos/storybook-utils';
11
+
10
12
  import { Stack, type StackProps } from './Stack';
11
13
  import { DemoStack } from './testing';
12
14
  import { Mosaic } from '../../mosaic';
@@ -29,7 +31,7 @@ export default {
29
31
  </Mosaic.Root>
30
32
  );
31
33
  },
32
- decorators: [FullscreenDecorator()],
34
+ decorators: [withTheme, FullscreenDecorator()],
33
35
  parameters: {
34
36
  layout: 'fullscreen',
35
37
  },
@@ -7,6 +7,8 @@ import '@dxosTheme';
7
7
  import { faker } from '@faker-js/faker';
8
8
  import React from 'react';
9
9
 
10
+ import { withTheme } from '@dxos/storybook-utils';
11
+
10
12
  import { Tree } from './Tree';
11
13
  import { GraphTree } from './testing';
12
14
  import { Mosaic } from '../../mosaic';
@@ -25,7 +27,7 @@ export default {
25
27
  </Mosaic.Root>
26
28
  );
27
29
  },
28
- decorators: [FullscreenDecorator()],
30
+ decorators: [withTheme, FullscreenDecorator()],
29
31
  parameters: {
30
32
  layout: 'fullscreen',
31
33
  },
@@ -7,6 +7,8 @@ import '@dxosTheme';
7
7
  import { faker } from '@faker-js/faker';
8
8
  import React from 'react';
9
9
 
10
+ import { withTheme } from '@dxos/storybook-utils';
11
+
10
12
  import { Tree } from './Tree';
11
13
  import { DemoTree, type DemoTreeProps } from './testing';
12
14
  import { Mosaic } from '../../mosaic';
@@ -77,7 +79,7 @@ export default {
77
79
  </Mosaic.Root>
78
80
  );
79
81
  },
80
- decorators: [FullscreenDecorator()],
82
+ decorators: [withTheme, FullscreenDecorator()],
81
83
  parameters: {
82
84
  layout: 'fullscreen',
83
85
  },
@@ -4,7 +4,8 @@
4
4
 
5
5
  import React, { forwardRef } from 'react';
6
6
 
7
- import { Card, Tree as TreeComponent, TreeItem as TreeItemComponent } from '@dxos/react-ui';
7
+ import { Tree as TreeComponent, TreeItem as TreeItemComponent } from '@dxos/react-ui';
8
+ import { Card } from '@dxos/react-ui-card';
8
9
  import { dropRing, mx } from '@dxos/react-ui-theme';
9
10
 
10
11
  import {