@destyler/dismissable 0.1.0 → 0.2.0

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.
@@ -30,13 +30,10 @@ const layerStack = {
30
30
  return this.pointerBlockingLayers().length > 0;
31
31
  },
32
32
  isBelowPointerBlockingLayer(node) {
33
- const index = this.indexOf(node);
34
- const highestBlockingIndex = this.topMostPointerBlockingLayer() ? this.indexOf(this.topMostPointerBlockingLayer()?.node) : -1;
35
- return index < highestBlockingIndex;
33
+ return this.indexOf(node) < (this.topMostPointerBlockingLayer() ? this.indexOf(this.topMostPointerBlockingLayer()?.node) : -1);
36
34
  },
37
35
  isTopMost(node) {
38
- const layer = this.layers[this.count() - 1];
39
- return layer?.node === node;
36
+ return this.layers[this.count() - 1]?.node === node;
40
37
  },
41
38
  getNestedLayers(node) {
42
39
  return Array.from(this.layers).slice(this.indexOf(node) + 1);
@@ -57,10 +54,7 @@ const layerStack = {
57
54
  remove(node) {
58
55
  const index = this.indexOf(node);
59
56
  if (index < 0) return;
60
- if (index < this.count() - 1) {
61
- const _layers = this.getNestedLayers(node);
62
- _layers.forEach((layer) => layer.dismiss());
63
- }
57
+ if (index < this.count() - 1) this.getNestedLayers(node).forEach((layer) => layer.dismiss());
64
58
  this.layers.splice(index, 1);
65
59
  node.style.removeProperty("--layer-index");
66
60
  },
package/package.json CHANGED
@@ -1,24 +1,33 @@
1
1
  {
2
2
  "name": "@destyler/dismissable",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "description": "Dismissable layer utilities for the dom",
6
6
  "author": "Elone Hoo <elonehoo@gmail.com>",
7
7
  "license": "MIT",
8
+ "homepage": "https://github.com/destyler/destyler",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/destyler/destyler.git",
12
+ "directory": "packages/shareds/dismissable"
13
+ },
8
14
  "exports": {
9
- ".": "./dist/index.js"
15
+ ".": "./dist/index.mjs"
10
16
  },
11
- "main": "dist/index.js",
12
- "module": "dist/index.js",
13
- "types": "dist/index.d.ts",
17
+ "main": "dist/index.mjs",
18
+ "module": "dist/index.mjs",
19
+ "types": "dist/index.d.mts",
14
20
  "files": [
15
21
  "*.d.ts",
16
22
  "dist"
17
23
  ],
18
24
  "dependencies": {
19
- "@destyler/interact-outside": "0.1.0",
20
- "@destyler/dom": "0.1.0",
21
- "@destyler/utils": "0.1.0"
25
+ "@destyler/dom": "0.2.0",
26
+ "@destyler/utils": "0.2.0",
27
+ "@destyler/interact-outside": "0.2.0"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
22
31
  },
23
32
  "scripts": {
24
33
  "clear": "rimraf ./dist",
File without changes