Skip to content

Commit 865029d

Browse files
committed
fix: fix node, window condition #132
1 parent 9239268 commit 865029d

File tree

5 files changed

+31
-31
lines changed

5 files changed

+31
-31
lines changed

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
]
6969
},
7070
"resolutions": {
71-
"@daybrush/utils": "^1.12.0",
71+
"@daybrush/utils": "^1.13.0",
7272
"@types/react": "^16.9.17",
7373
"typescript": "^4.5.0 <4.6.0",
7474
"@storybook/react": "^6.4.22",
@@ -84,12 +84,12 @@
8484
"@scena/matrix": "^1.1.1",
8585
"css-to-mat": "^1.0.3",
8686
"framework-utils": "^1.1.0",
87-
"gesto": "^1.18.1",
87+
"gesto": "^1.19.1",
8888
"overlap-area": "^1.1.0",
8989
"tslib": "^2.3.0"
9090
},
9191
"overrides": {
92-
"@daybrush/utils": "^1.12.0",
92+
"@daybrush/utils": "^1.13.0",
9393
"@types/react": "^16.9.17",
9494
"typescript": "^4.5.0 <4.6.0",
9595
"@storybook/react": "^6.4.22",
@@ -105,7 +105,7 @@
105105
"@scena/matrix": "^1.1.1",
106106
"css-to-mat": "^1.0.3",
107107
"framework-utils": "^1.1.0",
108-
"gesto": "^1.18.1",
108+
"gesto": "^1.19.1",
109109
"overlap-area": "^1.1.0",
110110
"tslib": "^2.3.0"
111111
}

packages/selecto/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "selecto",
3-
"version": "1.22.5",
3+
"version": "1.22.6",
44
"description": "Selecto.js is a component that allows you to select elements in the drag area using the mouse or touch.",
55
"main": "./dist/selecto.cjs.js",
66
"module": "./dist/selecto.esm.js",
@@ -33,14 +33,14 @@
3333
"dist/*"
3434
],
3535
"dependencies": {
36-
"@daybrush/utils": "^1.12.0",
36+
"@daybrush/utils": "^1.13.0",
3737
"@egjs/children-differ": "^1.0.1",
3838
"@scena/dragscroll": "^1.4.0",
3939
"@scena/event-emitter": "^1.0.5",
40-
"css-styled": "^1.0.7",
40+
"css-styled": "^1.0.8",
4141
"css-to-mat": "^1.0.3",
4242
"framework-utils": "^1.1.0",
43-
"gesto": "^1.18.1",
43+
"gesto": "^1.19.1",
4444
"keycon": "^1.2.0",
4545
"overlap-area": "^1.1.0"
4646
},

packages/selecto/src/SelectoManager.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
isFunction,
1616
getWindow,
1717
getDocument,
18+
isNode,
1819
} from "@daybrush/utils";
1920
import { diff } from "@egjs/children-differ";
2021
import DragScroll from "@scena/dragscroll";
@@ -300,7 +301,7 @@ class Selecto extends EventEmitter<SelectoEvents> {
300301
if (result) {
301302
selectableElements.push(...[].slice.call(result));
302303
}
303-
} else if (target instanceof Node) {
304+
} else if (isNode(target)) {
304305
selectableElements.push(target);
305306
} else if (isObject(target)) {
306307
selectableElements.push(target.value || target.current);
@@ -1419,10 +1420,9 @@ class Selecto extends EventEmitter<SelectoEvents> {
14191420
if (dragContainer === getWindow(this.container)) {
14201421
dragContainer = doc.documentElement;
14211422
}
1422-
const containers =
1423-
dragContainer instanceof Element
1424-
? [dragContainer]
1425-
: ([].slice.call(dragContainer) as Element[]);
1423+
const containers = isNode(dragContainer)
1424+
? [dragContainer]
1425+
: ([].slice.call(dragContainer) as Element[]);
14261426
const target = e.target;
14271427

14281428
containers.some((container) => {

packages/selecto/src/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function createElement(
4646
container?: HTMLElement | SVGElement,
4747
) {
4848
const { tag, children, attributes, className, style } = jsx;
49-
const el = prevTarget || document.createElement(tag) as HTMLElement | SVGElement;
49+
const el = prevTarget || getDocument(container).createElement(tag) as HTMLElement | SVGElement;
5050

5151
for (const name in attributes) {
5252
el.setAttribute(name, attributes[name]);

yarn.lock

+17-17
Original file line numberDiff line numberDiff line change
@@ -1916,10 +1916,10 @@
19161916
dependencies:
19171917
prototype-minify "^1.0.0"
19181918

1919-
"@daybrush/utils@^0.10.0", "@daybrush/utils@^0.10.1", "@daybrush/utils@^0.11.0", "@daybrush/utils@^1.0.0", "@daybrush/utils@^1.1.1", "@daybrush/utils@^1.11.0", "@daybrush/utils@^1.12.0", "@daybrush/utils@^1.3.1", "@daybrush/utils@^1.4.0", "@daybrush/utils@^1.6.0", "@daybrush/utils@^1.7.1":
1920-
version "1.12.0"
1921-
resolved "https://registry.npmjs.org/@daybrush/utils/-/utils-1.12.0.tgz#b0616a797e46c6fba070bd976119684e0656dcb7"
1922-
integrity sha512-5ir4E+bh8M3BNwkGp/lvKa0xpQe37W4ayUtNlmIt16l0xbRlGhs/62xE0d0Fyebr/+/6gV07R/1MeEcYZ2dtiA==
1919+
"@daybrush/utils@^0.10.0", "@daybrush/utils@^0.10.1", "@daybrush/utils@^0.11.0", "@daybrush/utils@^1.0.0", "@daybrush/utils@^1.1.1", "@daybrush/utils@^1.13.0", "@daybrush/utils@^1.3.1", "@daybrush/utils@^1.4.0", "@daybrush/utils@^1.6.0", "@daybrush/utils@^1.7.1":
1920+
version "1.13.0"
1921+
resolved "https://registry.npmjs.org/@daybrush/utils/-/utils-1.13.0.tgz#ea70a60864130da476406fdd1d465e3068aea0ff"
1922+
integrity sha512-ALK12C6SQNNHw1enXK+UO8bdyQ+jaWNQ1Af7Z3FNxeAwjYhQT7do+TRE4RASAJ3ObaS2+TJ7TXR3oz2Gzbw0PQ==
19231923

19241924
"@discoveryjs/json-ext@0.5.6":
19251925
version "0.5.6"
@@ -4553,9 +4553,9 @@
45534553
"@types/react" "*"
45544554

45554555
"@types/react@*", "@types/react@^16", "@types/react@^16.8.18", "@types/react@^16.9.17":
4556-
version "16.14.35"
4557-
resolved "https://registry.npmjs.org/@types/react/-/react-16.14.35.tgz#9d3cf047d85aca8006c4776693124a5be90ee429"
4558-
integrity sha512-NUEiwmSS1XXtmBcsm1NyRRPYjoZF2YTE89/5QiLt5mlGffYK9FQqOKuOLuXNrjPQV04oQgaZG+Yq02ZfHoFyyg==
4556+
version "16.14.42"
4557+
resolved "https://registry.npmjs.org/@types/react/-/react-16.14.42.tgz#7950af49c07df0ac24098abeec57367ebc662a39"
4558+
integrity sha512-r6lbqQBJsQ5JJ0fp5I1+F3weosNhk7jOEcKeusIlCDYUK6kCpvIkYCamBNqGyS6WEztYlT8wmAVgblV0HxOFoA==
45594559
dependencies:
45604560
"@types/prop-types" "*"
45614561
"@types/scheduler" "*"
@@ -8678,12 +8678,12 @@ css-styled@^1.0.0:
86788678
"@daybrush/utils" "^1.0.0"
86798679
string-hash "^1.1.3"
86808680

8681-
css-styled@^1.0.7:
8682-
version "1.0.7"
8683-
resolved "https://registry.npmjs.org/css-styled/-/css-styled-1.0.7.tgz#08bb17676b27e62b3978d1072c3dbbebb96edb51"
8684-
integrity sha512-ud6VclnjgwWxkxz3vrLTv7oEKP3xP/VeydTj5VAqa8zp5LFqKnHb7oSMgW+Z1R70Oz7sfBNEkv/H+yE9FhM4HQ==
8681+
css-styled@^1.0.8:
8682+
version "1.0.8"
8683+
resolved "https://registry.npmjs.org/css-styled/-/css-styled-1.0.8.tgz#c9c05dc4abdef5571033090bfb8cfc5e19429974"
8684+
integrity sha512-tCpP7kLRI8dI95rCh3Syl7I+v7PP+2JYOzWkl0bUEoSbJM+u8ITbutjlQVf0NC2/g4ULROJPi16sfwDIO8/84g==
86858685
dependencies:
8686-
"@daybrush/utils" "^1.11.0"
8686+
"@daybrush/utils" "^1.13.0"
86878687

86888688
css-to-mat@^1.0.3:
86898689
version "1.0.3"
@@ -11409,12 +11409,12 @@ gensync@^1.0.0-beta.1, gensync@^1.0.0-beta.2:
1140911409
resolved "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz"
1141011410
integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==
1141111411

11412-
gesto@^1.18.1, gesto@^1.2.1, gesto@^1.3.0, gesto@^1.9.0:
11413-
version "1.18.1"
11414-
resolved "https://registry.npmjs.org/gesto/-/gesto-1.18.1.tgz#8d026f4b7e4ba5118a0e1fdef411d33fc33a9cc9"
11415-
integrity sha512-1R7dozywz1NPqLvBlpLZdcIuq6xC+aW70364Jm5RicipO2pl3ruwCyzNxdgRHFfNJLIF4R3GaQpN9LvSbuNUvA==
11412+
gesto@^1.19.1, gesto@^1.2.1, gesto@^1.3.0, gesto@^1.9.0:
11413+
version "1.19.1"
11414+
resolved "https://registry.npmjs.org/gesto/-/gesto-1.19.1.tgz#b2a29730663eecf77b248982bbff929e79d4a461"
11415+
integrity sha512-ofWVEdqmnpFm3AFf7aoclhoayseb3OkwSiXbXusKYu/99iN5HgeWP+SWqdghQ5TFlOgP5Zlz+6SY8mP2V0kFaQ==
1141611416
dependencies:
11417-
"@daybrush/utils" "^1.12.0"
11417+
"@daybrush/utils" "^1.13.0"
1141811418
"@scena/event-emitter" "^1.0.2"
1141911419

1142011420
get-caller-file@^2.0.1, get-caller-file@^2.0.5:

0 commit comments

Comments
 (0)