@dxos/react-ui-mosaic 0.3.3-main.ef9deca → 0.3.3-main.f5c635b
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/types/src/testing/index.d.ts +0 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/views/Tree/testing.d.ts.map +1 -1
- package/package.json +12 -13
- package/src/testing/index.ts +0 -1
- package/src/views/Tree/testing.tsx +2 -3
- package/dist/types/src/testing/next-fractional-index.d.ts +0 -5
- package/dist/types/src/testing/next-fractional-index.d.ts.map +0 -1
- package/src/testing/next-fractional-index.ts +0 -36
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAE5B,cAAc,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../../../src/views/Tree/testing.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,KAAK,EAA2B,MAAM,iBAAiB,CAAC;AAItE,OAAO,EAAQ,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAM7D,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG;IACtC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,QAAQ,uCAAiD,aAAa,gBA0DlF,CAAC;AAEF,eAAO,MAAM,WAAW,aAqBvB,CAAC;AAcF,eAAO,MAAM,SAAS;QAAgD,MAAM;;WAAwB,OAAO;
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../../../src/views/Tree/testing.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,KAAK,EAA2B,MAAM,iBAAiB,CAAC;AAItE,OAAO,EAAQ,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAM7D,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG;IACtC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,QAAQ,uCAAiD,aAAa,gBA0DlF,CAAC;AAEF,eAAO,MAAM,WAAW,aAqBvB,CAAC;AAcF,eAAO,MAAM,SAAS;QAAgD,MAAM;;WAAwB,OAAO;iBAsC1G,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-mosaic",
|
|
3
|
-
"version": "0.3.3-main.
|
|
3
|
+
"version": "0.3.3-main.f5c635b",
|
|
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",
|
|
@@ -21,18 +21,17 @@
|
|
|
21
21
|
"@dnd-kit/utilities": "^3.2.0",
|
|
22
22
|
"@preact/signals-core": "^1.5.0",
|
|
23
23
|
"@radix-ui/react-compose-refs": "^1.0.0",
|
|
24
|
-
"@tldraw/indices": "2.0.0-alpha.14",
|
|
25
24
|
"deepsignal": "1.4.0-shallow.0",
|
|
26
25
|
"lodash.defaultsdeep": "^4.6.1",
|
|
27
26
|
"lodash.pick": "^4.4.0",
|
|
28
27
|
"react-resize-detector": "^7.1.2",
|
|
29
|
-
"@dxos/debug": "0.3.3-main.
|
|
30
|
-
"@dxos/invariant": "0.3.3-main.
|
|
31
|
-
"@dxos/keys": "0.3.3-main.
|
|
32
|
-
"@dxos/react-ui": "0.3.3-main.
|
|
33
|
-
"@dxos/react-ui-theme": "0.3.3-main.
|
|
34
|
-
"@dxos/react-ui-types": "0.3.3-main.
|
|
35
|
-
"@dxos/util": "0.3.3-main.
|
|
28
|
+
"@dxos/debug": "0.3.3-main.f5c635b",
|
|
29
|
+
"@dxos/invariant": "0.3.3-main.f5c635b",
|
|
30
|
+
"@dxos/keys": "0.3.3-main.f5c635b",
|
|
31
|
+
"@dxos/react-ui": "0.3.3-main.f5c635b",
|
|
32
|
+
"@dxos/react-ui-theme": "0.3.3-main.f5c635b",
|
|
33
|
+
"@dxos/react-ui-types": "0.3.3-main.f5c635b",
|
|
34
|
+
"@dxos/util": "0.3.3-main.f5c635b"
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|
|
38
37
|
"@faker-js/faker": "^8.0.2",
|
|
@@ -48,10 +47,10 @@
|
|
|
48
47
|
"react-dom": "^18.2.0",
|
|
49
48
|
"vite": "^4.3.9",
|
|
50
49
|
"vite-plugin-turbosnap": "^1.0.2",
|
|
51
|
-
"@dxos/app-graph": "0.3.3-main.
|
|
52
|
-
"@dxos/echo-schema": "0.3.3-main.
|
|
53
|
-
"@dxos/gem-core": "0.3.3-main.
|
|
54
|
-
"@dxos/react-client": "0.3.3-main.
|
|
50
|
+
"@dxos/app-graph": "0.3.3-main.f5c635b",
|
|
51
|
+
"@dxos/echo-schema": "0.3.3-main.f5c635b",
|
|
52
|
+
"@dxos/gem-core": "0.3.3-main.f5c635b",
|
|
53
|
+
"@dxos/react-client": "0.3.3-main.f5c635b"
|
|
55
54
|
},
|
|
56
55
|
"peerDependencies": {
|
|
57
56
|
"@phosphor-icons/react": "^2.0.5",
|
package/src/testing/index.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { arrayMove } from '@dxos/util';
|
|
|
11
11
|
|
|
12
12
|
import { Tree, type TreeData, type TreeProps } from './Tree';
|
|
13
13
|
import { type MosaicDropEvent, type MosaicMoveEvent, Path, type MosaicOperation } from '../../mosaic';
|
|
14
|
-
import { TestObjectGenerator
|
|
14
|
+
import { TestObjectGenerator } from '../../testing';
|
|
15
15
|
|
|
16
16
|
const fake = faker.helpers.fake;
|
|
17
17
|
|
|
@@ -134,8 +134,7 @@ export const GraphTree = ({ id, graph = createGraph(), debug }: { id: string; gr
|
|
|
134
134
|
operation === 'rearrange'
|
|
135
135
|
) {
|
|
136
136
|
// This is a rearrange operation
|
|
137
|
-
|
|
138
|
-
activeNode.properties.index = nextIndex ?? 'a0';
|
|
137
|
+
console.warn('[react-ui-mosaic]', 'Tree', 'rearrange', 'needs implementation');
|
|
139
138
|
} else if (activeNode && activeParent && overParent && operation === 'transfer') {
|
|
140
139
|
activeParent.removeNode(active.item.id);
|
|
141
140
|
overNode.addNode('tree', { ...activeNode });
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type UniqueIdentifier } from '@dnd-kit/core';
|
|
2
|
-
import { type Node } from '@dxos/app-graph';
|
|
3
|
-
export declare const nextRearrangeIndex: (nodes: Node[], activeId: UniqueIdentifier, overId?: UniqueIdentifier) => string | null;
|
|
4
|
-
export declare const nextCopyIndex: (nodes: Node[], overId?: UniqueIdentifier) => string;
|
|
5
|
-
//# sourceMappingURL=next-fractional-index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"next-fractional-index.d.ts","sourceRoot":"","sources":["../../../../src/testing/next-fractional-index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtD,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,eAAO,MAAM,kBAAkB,UAAW,IAAI,EAAE,YAAY,gBAAgB,WAAW,gBAAgB,kBAYtG,CAAC;AAEF,eAAO,MAAM,aAAa,UAAW,IAAI,EAAE,WAAW,gBAAgB,WAYrE,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type UniqueIdentifier } from '@dnd-kit/core';
|
|
6
|
-
import { getIndexAbove, getIndexBelow, getIndexBetween } from '@tldraw/indices';
|
|
7
|
-
|
|
8
|
-
import { type Node } from '@dxos/app-graph';
|
|
9
|
-
|
|
10
|
-
export const nextRearrangeIndex = (nodes: Node[], activeId: UniqueIdentifier, overId?: UniqueIdentifier) => {
|
|
11
|
-
const overOrderIndex = nodes.length > 0 ? nodes.findIndex(({ id }) => id === overId) : -1;
|
|
12
|
-
if (overOrderIndex >= 0) {
|
|
13
|
-
const activeOrderIndex = nodes.findIndex(({ id }) => id === activeId);
|
|
14
|
-
return overOrderIndex < 1
|
|
15
|
-
? getIndexBelow(nodes[overOrderIndex].properties.index)
|
|
16
|
-
: activeOrderIndex < overOrderIndex
|
|
17
|
-
? getIndexBetween(nodes[overOrderIndex].properties.index, nodes[overOrderIndex + 1]?.properties.index)
|
|
18
|
-
: getIndexBetween(nodes[overOrderIndex - 1].properties.index, nodes[overOrderIndex].properties.index);
|
|
19
|
-
} else {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const nextCopyIndex = (nodes: Node[], overId?: UniqueIdentifier) => {
|
|
25
|
-
const overOrderIndex = nodes.length > 0 ? nodes.findIndex(({ id }) => id === overId) : -1;
|
|
26
|
-
const previewOrderIndex = nodes.findIndex(({ id }) => id.startsWith('preview--'));
|
|
27
|
-
if (overOrderIndex >= 0) {
|
|
28
|
-
return overOrderIndex < 1
|
|
29
|
-
? getIndexBelow(nodes[overOrderIndex].properties.index)
|
|
30
|
-
: previewOrderIndex < overOrderIndex && previewOrderIndex >= 0
|
|
31
|
-
? getIndexBetween(nodes[overOrderIndex].properties.index, nodes[overOrderIndex + 1]?.properties.index)
|
|
32
|
-
: getIndexBetween(nodes[overOrderIndex - 1].properties.index, nodes[overOrderIndex]?.properties.index);
|
|
33
|
-
} else {
|
|
34
|
-
return nodes.length ? getIndexAbove(nodes[nodes.length - 1].properties.index) : 'a0';
|
|
35
|
-
}
|
|
36
|
-
};
|