Skip to content

Commit 93f4286

Browse files
authored
Merge pull request #345 from greggman/remove-uuid-dependency
remove uuid package
2 parents ce97e88 + 96cd65b commit 93f4286

File tree

4 files changed

+1364
-1372
lines changed

4 files changed

+1364
-1372
lines changed

examples/demo/TabStorage.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as React from "react";
22
import { useCallback, useEffect, useRef, useState } from "react";
3-
import { v4 } from "uuid";
43
import { Actions, IJsonTabNode, ILayoutProps, Layout, TabNode } from "../../src/index";
54

65
export function TabStorage({ tab, layout }: { tab: TabNode; layout: Layout; }) {
@@ -48,7 +47,7 @@ export function TabStorage({ tab, layout }: { tab: TabNode; layout: Layout; }) {
4847
const json = dragging instanceof TabNode ? dragging.toJson() as IJsonTabNode : dragging;
4948

5049
if (json.id === undefined) {
51-
json.id = `#${v4()}`;
50+
json.id = `#${crypto.randomUUID()}`;
5251
}
5352

5453
setStoredTabs(tabs => [...tabs, json]);
@@ -89,7 +88,7 @@ export function TabStorage({ tab, layout }: { tab: TabNode; layout: Layout; }) {
8988
const json = dragging instanceof TabNode ? dragging.toJson() as IJsonTabNode : dragging;
9089

9190
if (json.id === undefined) {
92-
json.id = `#${v4()}`;
91+
json.id = `#${crypto.randomUUID()}`;
9392
}
9493

9594
setStoredTabs(tabs => {

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,13 @@
4949
"@types/prismjs": "^1.26.0",
5050
"@types/react": "^18.0.5",
5151
"@types/react-dom": "^18.0.1",
52-
"@types/uuid": "^8.3.3",
5352
"css-loader": "^6.7.1",
5453
"cypress": "^9.5.4",
5554
"html-webpack-plugin": "^5.5.0",
5655
"prettier": "^2.6.2",
5756
"prismjs": "^1.28.0",
57+
"react": "^18.0.0",
58+
"react-dom": "^18.0.0",
5859
"react-scripts": "5.0.1",
5960
"sass": "^1.50.0",
6061
"source-map-loader": "^3.0.0",
@@ -66,7 +67,5 @@
6667
"webpack-cli": "^4.9.1",
6768
"webpack-dev-server": "^4.8.1"
6869
},
69-
"dependencies": {
70-
"uuid": "^8.3.2"
71-
}
70+
"dependencies": {}
7271
}

src/model/Model.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { v4 as getUUID } from "uuid";
21
import { Attribute } from "../Attribute";
32
import { AttributeDefinitions } from "../AttributeDefinitions";
43
import { DockLocation } from "../DockLocation";
@@ -510,7 +509,7 @@ export class Model {
510509

511510
/** @internal */
512511
_nextUniqueId() {
513-
return '#' + getUUID();
512+
return '#' + crypto.randomUUID ();
514513
}
515514

516515
/** @internal */

0 commit comments

Comments
 (0)