@danielgindi/selectbox 1.0.137 → 1.0.138

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.
@@ -0,0 +1,143 @@
1
+ import globals from "globals";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import js from "@eslint/js";
5
+ import { FlatCompat } from "@eslint/eslintrc";
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+ const compat = new FlatCompat({
10
+ baseDirectory: __dirname,
11
+ recommendedConfig: js.configs.recommended,
12
+ allConfig: js.configs.all,
13
+ });
14
+
15
+ export default [
16
+ {
17
+ ignores: [
18
+ "tests/**/*",
19
+ "test/**/*",
20
+ "!tests/**/*tests.js",
21
+ "!test/**/*tests.js",
22
+ "!tests/**/*_test.js",
23
+ "!test/**/*_test.js",
24
+ "!tests/**/*_helpers.js",
25
+ "!test/**/*_helpers.js",
26
+ "dist/**/*",
27
+ "example/**/*",
28
+ ],
29
+ },
30
+ ...compat.extends("eslint:recommended", "plugin:vue/recommended"),
31
+ {
32
+ languageOptions: {
33
+ globals: {
34
+ ...Object.fromEntries(Object.entries(globals.node).map(([key]) => [key, "off"])),
35
+ ...globals.browser,
36
+ },
37
+
38
+ ecmaVersion: 2020,
39
+ sourceType: "module",
40
+ },
41
+
42
+ rules: {
43
+ semi: ["warn", "always"],
44
+ "comma-dangle": ["warn", "always-multiline"],
45
+ "comma-style": ["warn", "last"],
46
+ "no-var": ["warn"],
47
+
48
+ "arrow-spacing": ["warn", {
49
+ before: true,
50
+ after: true,
51
+ }],
52
+
53
+ "space-infix-ops": ["warn", {
54
+ int32Hint: true,
55
+ }],
56
+
57
+ "keyword-spacing": ["warn", {
58
+ before: true,
59
+ after: true,
60
+ }],
61
+
62
+ "space-unary-ops": ["warn", {
63
+ words: true,
64
+ nonwords: false,
65
+ }],
66
+
67
+ "comma-spacing": ["warn", {
68
+ before: false,
69
+ after: true,
70
+ }],
71
+
72
+ "object-curly-spacing": ["warn", "always"],
73
+
74
+ "no-unused-vars": ["warn", {
75
+ vars: "all",
76
+ args: "after-used",
77
+ varsIgnorePattern: "[iIgnored]|^_",
78
+ ignoreRestSiblings: false,
79
+ argsIgnorePattern: "^_",
80
+ caughtErrors: "all",
81
+ caughtErrorsIgnorePattern: "^ignore",
82
+ }],
83
+
84
+ "no-console": "warn",
85
+ "no-extra-semi": "warn",
86
+ "no-unreachable": "warn",
87
+
88
+ "no-fallthrough": ["error", {
89
+ commentPattern: "break[\\s\\w]*omitted|fallthrough",
90
+ }],
91
+
92
+ "no-useless-escape": "warn",
93
+ "no-constant-condition": "warn",
94
+ "no-return-await": "warn",
95
+ "no-async-promise-executor": "warn",
96
+
97
+ "vue/no-unused-vars": ["warn", {
98
+ ignorePattern: "^_",
99
+ }],
100
+
101
+ "vue/require-default-prop": ["off"],
102
+ "vue/no-v-html": ["off"],
103
+ },
104
+ },
105
+ {
106
+ files: [
107
+ "tests/**/*tests.js",
108
+ "test/**/*tests.js",
109
+ "tests/**/*_test.js",
110
+ "test/**/*_test.js",
111
+ ],
112
+
113
+ languageOptions: {
114
+ globals: {
115
+ ...Object.fromEntries(Object.entries(globals.browser).map(([key]) => [key, "off"])),
116
+ ...globals.node,
117
+ ...globals.mocha,
118
+ ...globals.jest,
119
+ },
120
+ },
121
+
122
+ rules: {
123
+ "no-console": "off",
124
+ },
125
+ },
126
+ {
127
+ files: ["*db*/**/migrations/**/*.js"],
128
+
129
+ rules: {
130
+ "no-console": "off",
131
+ },
132
+ },
133
+ {
134
+ files: ["scripts/**/*.js", "**/eslint.config.mjs"],
135
+
136
+ languageOptions: {
137
+ globals: {
138
+ ...Object.fromEntries(Object.entries(globals.browser).map(([key]) => [key, "off"])),
139
+ ...globals.node,
140
+ },
141
+ },
142
+ },
143
+ ];
package/lib/DropList.js CHANGED
@@ -1578,7 +1578,7 @@ class DropList {
1578
1578
  let itemPos, previousPos = -1;
1579
1579
  let maxIterations = 30; // Some zoom/scroll issues can make it so that it takes almost forever
1580
1580
 
1581
- // eslint-disable-next-line no-constant-condition
1581
+
1582
1582
  while (maxIterations-- > 0) {
1583
1583
  itemPos = p.virtualListHelper.getItemPosition(itemIndex);
1584
1584
 
@@ -2116,7 +2116,7 @@ class DropList {
2116
2116
  let base = getElementOffset(p.focusItemEl).top;
2117
2117
  let height = getElementHeight(p.el, true);
2118
2118
 
2119
- while (true) { // eslint-disable-line no-constant-condition
2119
+ while (true) {
2120
2120
  next = p.focusItemEl.nextElementSibling;
2121
2121
  if (!next) return;
2122
2122
  if (next.tagName !== 'LI') continue;
package/lib/SelectBox.js CHANGED
@@ -462,6 +462,20 @@ class SelectBox {
462
462
  return this._p.el;
463
463
  }
464
464
 
465
+ get droplistInstance() {
466
+ return this._p.dropList;
467
+ }
468
+
469
+ /**
470
+ * Returns true if other is an inclusive descendant of droplist node, false otherwise, and undefined if the droplist is not initiated.
471
+ * @param {Node} other
472
+ * @param {boolean} [considerSubmenus=true]
473
+ * @returns {boolean|undefined}
474
+ */
475
+ droplistElContains(other, considerSubmenus = true) {
476
+ return this._p.dropList?.elContains(other, considerSubmenus);
477
+ }
478
+
465
479
  /**
466
480
  * Enables the control
467
481
  * @param {boolean=true} enabled Should the control be enabled?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielgindi/selectbox",
3
- "version": "1.0.137",
3
+ "version": "1.0.138",
4
4
  "description": "A collection of dom utilities. So you can work natively with the dom without dom frameworks.",
5
5
  "main": "dist/lib.cjs.min.js",
6
6
  "module": "lib/index.js",
@@ -31,22 +31,25 @@
31
31
  "homepage": "https://github.com/danielgindi/selectbox#readme",
32
32
  "license": "MIT",
33
33
  "devDependencies": {
34
- "@babel/core": "^7.24.3",
35
- "@babel/preset-env": "^7.24.3",
36
- "@babel/runtime": "^7.24.1",
34
+ "@babel/core": "^7.25.2",
35
+ "@babel/preset-env": "^7.25.3",
36
+ "@babel/runtime": "^7.25.0",
37
+ "@eslint/eslintrc": "^3.1.0",
38
+ "@eslint/js": "^9.8.0",
37
39
  "@rollup/plugin-babel": "^6.0.4",
38
- "@rollup/plugin-commonjs": "^25.0.7",
40
+ "@rollup/plugin-commonjs": "^26.0.1",
39
41
  "@rollup/plugin-node-resolve": "^15.2.3",
40
42
  "@rollup/plugin-terser": "^0.4.4",
41
- "core-js": "^3.36.1",
42
- "eslint": "^8.57.0",
43
+ "core-js": "^3.38.0",
44
+ "eslint": "^9.8.0",
43
45
  "eslint-formatter-codeframe": "^7.32.1",
44
- "eslint-plugin-vue": "^9.24.0",
46
+ "eslint-plugin-vue": "^9.27.0",
45
47
  "fs-extra": "^11.2.0",
46
- "husky": "^9.0.11",
48
+ "globals": "^15.9.0",
49
+ "husky": "^9.1.4",
47
50
  "pinst": "^3.0.0",
48
- "rollup": "^4.13.2",
49
- "sass": "^1.72.0"
51
+ "rollup": "^4.20.0",
52
+ "sass": "^1.77.8"
50
53
  },
51
54
  "dependencies": {
52
55
  "@danielgindi/dom-utils": "^1.0.8",
package/vue/DropList.vue CHANGED
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <span v-show="false" />
2
+ <span v-show="false" />
3
3
  </template>
4
4
 
5
5
  <script>
package/vue/SelectBox.vue CHANGED
@@ -894,6 +894,10 @@
894
894
  blur() {
895
895
  this.nonReactive.instance?.blurInput();
896
896
  },
897
+
898
+ droplistElContains(other, considerSublists = true) {
899
+ return this.nonReactive.instance?.droplistElContains(other, considerSublists);
900
+ },
897
901
  },
898
902
  };
899
903
  </script>