@dxos/react-ui-mosaic 0.3.9-main.58adff6 → 0.3.9-main.5d43cb5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Tile.d.ts","sourceRoot":"","sources":["../../../../src/mosaic/Tile.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,mBAAmB,EAA8B,MAAM,eAAe,CAAC;AAGrF,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAyB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAErG,OAAO,EAAgB,KAAK,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAG9F,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,SAAS,CAAC;AAGjE,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,aAAa,CAAC;AAElF,MAAM,MAAM,gBAAgB,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAA;CAAE,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,eAAe,CAAC,KAAK,SAAS,cAAc,GAAG,cAAc,EAAE,SAAS,GAAG,OAAO,IAAI,IAAI,CACpG,cAAc,CAAC,cAAc,CAAC,EAC9B,WAAW,CACZ,GACC,sBAAsB,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,KAAK,CAAC;IACZ,SAAS,CAAC,EAAE,mBAAmB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC5C,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAG1B,UAAU,CAAC,EAAE,OAAO,CAAC;I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W,CAC1B,GAAG;IAAE,SAAS,EAAE,eAAe,CAAA;CAAE,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAC7B,KAAK,SAAS,cAAc,GAAG,cAAc,EAC7C,QAAQ,SAAS,WAAW,GAAG,cAAc,IAC3C,yBAAyB,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAC;AAEzF;;GAEG;AACH,eAAO,MAAM,aAAa,oFAQvB,gBAAgB,GAAG,CAAC,gBA0BtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,oEAOvB,gBAAgB,GAAG,CAAC,gBAuBtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,uGAQtB,gBAAgB,GAAG,EAAE,MAAM,CAAC,gBAuD9B,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './data';
2
2
  export * from './path';
3
+ export * from './props';
3
4
  export * from './styles';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/mosaic/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/mosaic/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type MosaicTileComponentProps, type MosaicTileProps } from '../Tile';
2
+ export declare const isTileProps: (props: Record<string, unknown>) => props is MosaicTileProps;
3
+ export declare const isTileComponentProps: (props: Record<string, unknown>) => props is MosaicTileComponentProps;
4
+ //# sourceMappingURL=props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../../../src/mosaic/util/props.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC;AAE9E,eAAO,MAAM,WAAW,UAAW,OAAO,MAAM,EAAE,OAAO,CAAC,6BAG/C,CAAC;AAEZ,eAAO,MAAM,oBAAoB,UAAW,OAAO,MAAM,EAAE,OAAO,CAAC,sCACsC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-mosaic",
3
- "version": "0.3.9-main.58adff6",
3
+ "version": "0.3.9-main.5d43cb5",
4
4
  "description": "An intermediate interface for drag-and-drop interactions.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -25,13 +25,13 @@
25
25
  "lodash.defaultsdeep": "^4.6.1",
26
26
  "lodash.pick": "^4.4.0",
27
27
  "react-resize-detector": "^7.1.2",
28
- "@dxos/debug": "0.3.9-main.58adff6",
29
- "@dxos/invariant": "0.3.9-main.58adff6",
30
- "@dxos/keys": "0.3.9-main.58adff6",
31
- "@dxos/react-ui": "0.3.9-main.58adff6",
32
- "@dxos/react-ui-theme": "0.3.9-main.58adff6",
33
- "@dxos/react-ui-types": "0.3.9-main.58adff6",
34
- "@dxos/util": "0.3.9-main.58adff6"
28
+ "@dxos/debug": "0.3.9-main.5d43cb5",
29
+ "@dxos/invariant": "0.3.9-main.5d43cb5",
30
+ "@dxos/react-ui": "0.3.9-main.5d43cb5",
31
+ "@dxos/keys": "0.3.9-main.5d43cb5",
32
+ "@dxos/react-ui-types": "0.3.9-main.5d43cb5",
33
+ "@dxos/react-ui-theme": "0.3.9-main.5d43cb5",
34
+ "@dxos/util": "0.3.9-main.5d43cb5"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@faker-js/faker": "^8.0.2",
@@ -47,10 +47,10 @@
47
47
  "react-dom": "^18.2.0",
48
48
  "vite": "^4.3.9",
49
49
  "vite-plugin-turbosnap": "^1.0.2",
50
- "@dxos/app-graph": "0.3.9-main.58adff6",
51
- "@dxos/echo-schema": "0.3.9-main.58adff6",
52
- "@dxos/gem-core": "0.3.9-main.58adff6",
53
- "@dxos/react-client": "0.3.9-main.58adff6"
50
+ "@dxos/app-graph": "0.3.9-main.5d43cb5",
51
+ "@dxos/gem-core": "0.3.9-main.5d43cb5",
52
+ "@dxos/echo-schema": "0.3.9-main.5d43cb5",
53
+ "@dxos/react-client": "0.3.9-main.5d43cb5"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@phosphor-icons/react": "^2.0.5",
package/src/index.ts CHANGED
@@ -3,6 +3,3 @@
3
3
  //
4
4
 
5
5
  export * from './mosaic';
6
-
7
- // TODO(burdon): Remove (factor out components).
8
- export * from './views';
@@ -37,7 +37,8 @@ export type MosaicTileOverlayProps = {
37
37
  * * `reject` - The tile is not allowed where it was dropped.
38
38
  */
39
39
  // TODO(wittjosiah): Add 'delete'. Consider adding 'swap'.
40
- export type MosaicOperation = 'transfer' | 'copy' | 'rearrange' | 'reject';
40
+ export const MosaicOperations = ['transfer', 'copy', 'rearrange', 'reject'] as const;
41
+ export type MosaicOperation = (typeof MosaicOperations)[number];
41
42
 
42
43
  export type MosaicMoveEvent<TPosition = unknown> = {
43
44
  active: MosaicDraggedItem<TPosition>;
@@ -79,6 +79,7 @@ export const MosaicDragOverlay = ({ delay = 200, debug = false, ...overlayProps
79
79
  {...container.getOverlayProps?.()}
80
80
  item={activeItem.item}
81
81
  path={activeItem.path}
82
+ type={activeItem.type}
82
83
  operation={operation}
83
84
  active='overlay'
84
85
  />
@@ -15,6 +15,7 @@ import { getTransformCSS, Path } from './util';
15
15
 
16
16
  export type MosaicActiveType = 'overlay' | 'rearrange' | 'origin' | 'destination';
17
17
 
18
+ // TODO(wittjosiah): `id` should be `path` and `data` should be a `MosaicDataItem`.
18
19
  export type MosaicTileAction = { id: string; action: string; data?: any };
19
20
 
20
21
  /**
@@ -48,15 +49,18 @@ export type MosaicTileProps<TData extends MosaicDataItem = MosaicDataItem, TPosi
48
49
  onAction?: (action: MosaicTileAction) => void;
49
50
  };
50
51
 
52
+ export type MosaicTileComponentProps<TData extends MosaicDataItem = MosaicDataItem> = Omit<
53
+ MosaicTileProps<TData>,
54
+ 'Component' | 'operation'
55
+ > & { operation: MosaicOperation };
56
+
51
57
  /**
52
58
  * Mosaic Tile component.
53
59
  */
54
60
  export type MosaicTileComponent<
55
61
  TData extends MosaicDataItem = MosaicDataItem,
56
62
  TElement extends HTMLElement = HTMLDivElement,
57
- > = ForwardRefExoticComponent<
58
- RefAttributes<TElement> & Omit<MosaicTileProps<TData>, 'Component' | 'operation'> & { operation: MosaicOperation }
59
- >;
63
+ > = ForwardRefExoticComponent<RefAttributes<TElement> & MosaicTileComponentProps<TData>>;
60
64
 
61
65
  /**
62
66
  * Basic draggable mosaic tile.
@@ -4,4 +4,5 @@
4
4
 
5
5
  export * from './data';
6
6
  export * from './path';
7
+ export * from './props';
7
8
  export * from './styles';
@@ -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);