jqtree 1.6.3 → 1.7.1

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.
Files changed (97) hide show
  1. package/.github/workflows/ci.yml +15 -21
  2. package/.github/workflows/codeql-analysis.yml +2 -2
  3. package/README.md +1 -1
  4. package/bower.json +10 -3
  5. package/config/production +2 -2
  6. package/config/{rollup.config.js → rollup.config.mjs} +3 -8
  7. package/docs/Gemfile.lock +34 -37
  8. package/docs/_config.yml +1 -1
  9. package/docs/_entries/10_changelog.md +13 -0
  10. package/docs/_entries/93_getnextnode.md +4 -1
  11. package/docs/_entries/{95_getpreviousnode.md → 95_getnextvisiblenode.md} +1 -1
  12. package/docs/_entries/96_getpreviousnode.md +0 -0
  13. package/docs/_entries/98_getpreviousvisiblenode.md +14 -0
  14. package/docs/package.json +7 -7
  15. package/docs/pnpm-lock.yaml +413 -265
  16. package/docs/static/bower.json +2 -2
  17. package/docs/static/bower_components/fontawesome/css/all.min.css +6 -2
  18. package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.ttf +0 -0
  19. package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
  20. package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.ttf +0 -0
  21. package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
  22. package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.ttf +0 -0
  23. package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
  24. package/docs/static/bower_components/fontawesome/webfonts/fa-v4compatibility.ttf +0 -0
  25. package/docs/static/bower_components/fontawesome/webfonts/fa-v4compatibility.woff2 +0 -0
  26. package/docs/static/bower_components/jquery/dist/jquery.js +944 -1121
  27. package/docs/static/bower_components/jquery/dist/jquery.min.js +2 -2
  28. package/docs/static/documentation.css +181 -159
  29. package/docs/static/example.css +0 -1
  30. package/docs/tree.jquery.js +3 -3
  31. package/lib/dataLoader.js +5 -31
  32. package/lib/dragAndDropHandler.js +40 -142
  33. package/lib/elementsRenderer.js +52 -72
  34. package/lib/keyHandler.js +8 -32
  35. package/lib/mouse.widget.js +24 -74
  36. package/lib/node.js +72 -134
  37. package/lib/nodeElement.js +24 -84
  38. package/lib/playwright/coverage.js +58 -97
  39. package/lib/playwright/playwright.test.js +148 -210
  40. package/lib/playwright/testUtils.js +116 -182
  41. package/lib/saveStateHandler.js +13 -62
  42. package/lib/scrollHandler.js +24 -77
  43. package/lib/selectNodeHandler.js +6 -25
  44. package/lib/simple.widget.js +20 -53
  45. package/lib/test/jqTree/accessibility.test.js +37 -0
  46. package/lib/test/jqTree/create.test.js +0 -4
  47. package/lib/test/jqTree/events.test.js +73 -84
  48. package/lib/test/jqTree/keyboard.test.js +0 -6
  49. package/lib/test/jqTree/loadOnDemand.test.js +84 -121
  50. package/lib/test/jqTree/methods.test.js +107 -150
  51. package/lib/test/jqTree/options.test.js +32 -54
  52. package/lib/test/node.test.js +134 -76
  53. package/lib/test/nodeUtil.test.js +0 -1
  54. package/lib/test/support/jqTreeMatchers.js +4 -9
  55. package/lib/test/support/setupTests.js +0 -4
  56. package/lib/test/support/testUtil.js +2 -11
  57. package/lib/test/support/treeStructure.js +0 -6
  58. package/lib/test/util.test.js +0 -1
  59. package/lib/tree.jquery.js +28 -239
  60. package/lib/util.js +0 -6
  61. package/lib/version.js +1 -1
  62. package/package.json +44 -47
  63. package/src/dragAndDropHandler.ts +24 -10
  64. package/src/elementsRenderer.ts +49 -42
  65. package/src/jqtreeOptions.ts +3 -3
  66. package/src/keyHandler.ts +3 -3
  67. package/src/mouse.widget.ts +12 -0
  68. package/src/node.ts +52 -16
  69. package/src/nodeElement.ts +27 -21
  70. package/src/saveStateHandler.ts +1 -1
  71. package/src/scrollHandler.ts +6 -2
  72. package/src/selectNodeHandler.ts +1 -1
  73. package/src/simple.widget.ts +2 -0
  74. package/src/test/.eslintrc +3 -1
  75. package/src/test/jqTree/accessibility.test.ts +25 -0
  76. package/src/test/jqTree/events.test.ts +79 -93
  77. package/src/test/jqTree/methods.test.ts +1 -1
  78. package/src/test/node.test.ts +152 -58
  79. package/src/test/nodeUtil.test.ts +1 -1
  80. package/src/tree.jquery.ts +7 -6
  81. package/src/version.ts +1 -1
  82. package/tree.jquery.debug.js +297 -904
  83. package/tree.jquery.debug.js.map +1 -1
  84. package/tree.jquery.js +3 -3
  85. package/tree.jquery.js.map +1 -1
  86. package/tsconfig.json +1 -0
  87. package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.eot +0 -0
  88. package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.svg +0 -3717
  89. package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.woff +0 -0
  90. package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.eot +0 -0
  91. package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.svg +0 -801
  92. package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.woff +0 -0
  93. package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.eot +0 -0
  94. package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.svg +0 -5028
  95. package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.woff +0 -0
  96. /package/docs/_entries/{96_getprevioussibling.md → 97_getprevioussibling.md} +0 -0
  97. /package/docs/_entries/{97_parent.md → 99_parent.md} +0 -0
@@ -12,17 +12,17 @@ jobs:
12
12
  - name: Setup node
13
13
  uses: actions/setup-node@v3
14
14
  with:
15
- node-version: "16"
15
+ node-version: 16
16
16
  - name: Install pnpm
17
17
  run: npm install -g pnpm
18
18
  - name: Get pnpm store directory
19
19
  id: pnpm-cache
20
20
  run: |
21
- echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
21
+ echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
22
22
  - uses: actions/cache@v3
23
23
  name: Setup pnpm cache
24
24
  with:
25
- path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
25
+ path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
26
26
  key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
27
27
  restore-keys: |
28
28
  ${{ runner.os }}-pnpm-store-
@@ -38,21 +38,21 @@ jobs:
38
38
  pnpm install
39
39
  - name: Build
40
40
  run: |
41
- pnpm production
41
+ pnpm run production
42
42
  - name: Lint
43
43
  run: |
44
- pnpm lint
44
+ pnpm run lint
45
45
  - name: Check types
46
46
  run: |
47
- pnpm tsc
47
+ pnpm run tsc
48
48
  - name: Clean coverage
49
- run: pnpm clean-coverage
49
+ run: rm -rf .nyc_output && npx jest --clearCache
50
50
  - name: Run jest tests
51
- run: pnpm jest
51
+ run: pnpm run jest
52
52
  - name: Playwright install
53
53
  run: npx playwright install chromium
54
54
  - name: Run playwright tests
55
- run: pnpm playwright
55
+ run: pnpm run playwright
56
56
  - name: Screenshots artifact
57
57
  if: always()
58
58
  uses: actions/upload-artifact@v3
@@ -60,20 +60,14 @@ jobs:
60
60
  name: screenshots
61
61
  path: src/playwright/playwright.test.ts-snapshots/
62
62
  - name: Merge coverage
63
- run: |
64
- pnpm merge-coverage
65
- pnpm print-coverage
63
+ run: cp jest-coverage/coverage-final.json .nyc_output/coverage_jsdom.json
66
64
  - name: Coverage artifact
67
65
  uses: actions/upload-artifact@v3
68
66
  with:
69
67
  name: coverage
70
68
  path: .nyc_output
71
- - name: Coveralls
72
- run: |
73
- pnpm coveralls
74
- env:
75
- COVERALLS_REPO_TOKEN: ${{ secrets.github_token }}
76
- COVERALLS_SERVICE_NAME: github
77
- COVERALLS_GIT_COMMIT: ${{ github.sha }}
78
- COVERALLS_GIT_BRANCH: ${{ github.ref }}
79
- COVERALLS_SERVICE_JOB_ID: ${{ github.run_id }}
69
+ - name: Codecov
70
+ uses: codecov/codecov-action@v3
71
+ with:
72
+ directory: .nyc_output
73
+ verbose: true
@@ -2,9 +2,9 @@ name: "CodeQL"
2
2
 
3
3
  on:
4
4
  push:
5
- branches: [master]
5
+ branches: [dev]
6
6
  pull_request:
7
- branches: [master]
7
+ branches: [dev]
8
8
 
9
9
  jobs:
10
10
  analyze:
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ![Build](https://github.com/mbraak/jqTree/workflows/Continuous%20integration/badge.svg) [![Coverage Status](https://img.shields.io/coveralls/mbraak/jqTree.svg)](https://coveralls.io/r/mbraak/jqTree)
1
+ ![Build](https://github.com/mbraak/jqTree/workflows/Continuous%20integration/badge.svg) [![codecov](https://codecov.io/gh/mbraak/jqTree/branch/dev/graph/badge.svg?token=DKzjY5YUlq)](https://codecov.io/gh/mbraak/jqTree)
2
2
 
3
3
  [![NPM version](https://img.shields.io/npm/v/jqtree.svg)](https://www.npmjs.com/package/jqtree)
4
4
 
package/bower.json CHANGED
@@ -1,11 +1,18 @@
1
1
  {
2
2
  "name": "jqTree",
3
- "version": "1.6.3",
4
- "main": ["jqtree.css", "jqtree-circle.png", "tree.jquery.js"],
3
+ "version": "1.7.1",
4
+ "main": [
5
+ "jqtree.css",
6
+ "jqtree-circle.png",
7
+ "tree.jquery.js"
8
+ ],
5
9
  "dependencies": {
6
10
  "jquery": ">=1.9"
7
11
  },
8
12
  "license": "Apache-2.0",
9
13
  "ignore": [],
10
- "keywords": ["jquery-plugin", "tree"]
14
+ "keywords": [
15
+ "jquery-plugin",
16
+ "tree"
17
+ ]
11
18
  }
package/config/production CHANGED
@@ -1,4 +1,4 @@
1
- rollup -c config/rollup.config.js &&
2
- DEBUG_BUILD=true rollup -c config/rollup.config.js &&
1
+ rollup -c config/rollup.config.mjs &&
2
+ DEBUG_BUILD=true rollup -c config/rollup.config.mjs &&
3
3
  babel src --config-file ./config/babel.config.json --out-dir lib --extensions .ts &&
4
4
  postcss --config ./config -o jqtree.css css/jqtree.postcss
@@ -1,11 +1,10 @@
1
1
  import fs from "fs";
2
- import path from "path";
3
2
  import jsonfile from "jsonfile";
4
3
  import template from "lodash.template";
5
4
  import { babel } from "@rollup/plugin-babel";
6
5
  import resolve from "@rollup/plugin-node-resolve";
7
6
  import serve from "rollup-plugin-serve";
8
- import { terser } from "rollup-plugin-terser";
7
+ import terser from "@rollup/plugin-terser";
9
8
 
10
9
  const getBanner = () => {
11
10
  const headerTemplate = fs.readFileSync("./src/header.txt", "utf8");
@@ -32,7 +31,7 @@ const babelConfigFile = includeCoverage
32
31
 
33
32
  const babelPlugin = babel({
34
33
  babelHelpers: "bundled",
35
- configFile: path.resolve(__dirname, babelConfigFile),
34
+ configFile: `./config/${babelConfigFile}`,
36
35
  extensions: [".ts"],
37
36
  });
38
37
 
@@ -49,11 +48,7 @@ if (!debugBuild) {
49
48
 
50
49
  if (devServer) {
51
50
  const servePlugin = serve({
52
- contentBase: [
53
- path.join(__dirname, "../devserver"),
54
- path.join(__dirname, "../docs/static"),
55
- path.join(__dirname, ".."),
56
- ],
51
+ contentBase: ["./devserver", "./docs/static", "./"],
57
52
  port: 8080,
58
53
  });
59
54
  plugins.push(servePlugin);
package/docs/Gemfile.lock CHANGED
@@ -1,43 +1,42 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- activesupport (6.0.5)
4
+ activesupport (7.0.4.3)
5
5
  concurrent-ruby (~> 1.0, >= 1.0.2)
6
- i18n (>= 0.7, < 2)
7
- minitest (~> 5.1)
8
- tzinfo (~> 1.1)
9
- zeitwerk (~> 2.2, >= 2.2.2)
10
- addressable (2.8.0)
11
- public_suffix (>= 2.0.2, < 5.0)
6
+ i18n (>= 1.6, < 2)
7
+ minitest (>= 5.1)
8
+ tzinfo (~> 2.0)
9
+ addressable (2.8.1)
10
+ public_suffix (>= 2.0.2, < 6.0)
12
11
  coffee-script (2.4.1)
13
12
  coffee-script-source
14
13
  execjs
15
14
  coffee-script-source (1.11.1)
16
15
  colorator (1.1.0)
17
- commonmarker (0.23.4)
18
- concurrent-ruby (1.1.10)
16
+ commonmarker (0.23.9)
17
+ concurrent-ruby (1.2.2)
19
18
  dnsruby (1.61.9)
20
19
  simpleidn (~> 0.1)
21
20
  em-websocket (0.5.3)
22
21
  eventmachine (>= 0.12.9)
23
22
  http_parser.rb (~> 0)
24
- ethon (0.15.0)
23
+ ethon (0.16.0)
25
24
  ffi (>= 1.15.0)
26
25
  eventmachine (1.2.7)
27
26
  execjs (2.8.1)
28
- faraday (2.3.0)
29
- faraday-net_http (~> 2.0)
27
+ faraday (2.7.4)
28
+ faraday-net_http (>= 2.0, < 3.1)
30
29
  ruby2_keywords (>= 0.0.4)
31
- faraday-net_http (2.0.3)
30
+ faraday-net_http (3.0.2)
32
31
  ffi (1.15.5)
33
32
  forwardable-extended (2.6.0)
34
33
  gemoji (3.0.1)
35
- github-pages (226)
34
+ github-pages (228)
36
35
  github-pages-health-check (= 1.17.9)
37
- jekyll (= 3.9.2)
36
+ jekyll (= 3.9.3)
38
37
  jekyll-avatar (= 0.7.0)
39
38
  jekyll-coffeescript (= 1.1.1)
40
- jekyll-commonmark-ghpages (= 0.2.0)
39
+ jekyll-commonmark-ghpages (= 0.4.0)
41
40
  jekyll-default-layout (= 0.1.4)
42
41
  jekyll-feed (= 0.15.1)
43
42
  jekyll-gist (= 1.5.0)
@@ -71,10 +70,10 @@ GEM
71
70
  jemoji (= 0.12.0)
72
71
  kramdown (= 2.3.2)
73
72
  kramdown-parser-gfm (= 1.1.0)
74
- liquid (= 4.0.3)
73
+ liquid (= 4.0.4)
75
74
  mercenary (~> 0.3)
76
75
  minima (= 2.5.1)
77
- nokogiri (>= 1.13.4, < 2.0)
76
+ nokogiri (>= 1.13.6, < 2.0)
78
77
  rouge (= 3.26.0)
79
78
  terminal-table (~> 1.4)
80
79
  github-pages-health-check (1.17.9)
@@ -83,17 +82,17 @@ GEM
83
82
  octokit (~> 4.0)
84
83
  public_suffix (>= 3.0, < 5.0)
85
84
  typhoeus (~> 1.3)
86
- html-pipeline (2.14.1)
85
+ html-pipeline (2.14.3)
87
86
  activesupport (>= 2)
88
87
  nokogiri (>= 1.4)
89
88
  http_parser.rb (0.8.0)
90
- i18n (0.9.5)
89
+ i18n (1.12.0)
91
90
  concurrent-ruby (~> 1.0)
92
- jekyll (3.9.2)
91
+ jekyll (3.9.3)
93
92
  addressable (~> 2.4)
94
93
  colorator (~> 1.0)
95
94
  em-websocket (~> 0.5)
96
- i18n (~> 0.7)
95
+ i18n (>= 0.7, < 2)
97
96
  jekyll-sass-converter (~> 1.0)
98
97
  jekyll-watch (~> 2.0)
99
98
  kramdown (>= 1.17, < 3)
@@ -109,11 +108,11 @@ GEM
109
108
  coffee-script-source (~> 1.11.1)
110
109
  jekyll-commonmark (1.4.0)
111
110
  commonmarker (~> 0.22)
112
- jekyll-commonmark-ghpages (0.2.0)
113
- commonmarker (~> 0.23.4)
111
+ jekyll-commonmark-ghpages (0.4.0)
112
+ commonmarker (~> 0.23.7)
114
113
  jekyll (~> 3.9.0)
115
114
  jekyll-commonmark (~> 1.4.0)
116
- rouge (>= 2.0, < 4.0)
115
+ rouge (>= 2.0, < 5.0)
117
116
  jekyll-default-layout (0.1.4)
118
117
  jekyll (~> 3.0)
119
118
  jekyll-feed (0.15.1)
@@ -201,28 +200,28 @@ GEM
201
200
  rexml
202
201
  kramdown-parser-gfm (1.1.0)
203
202
  kramdown (~> 2.0)
204
- liquid (4.0.3)
205
- listen (3.7.1)
203
+ liquid (4.0.4)
204
+ listen (3.8.0)
206
205
  rb-fsevent (~> 0.10, >= 0.10.3)
207
206
  rb-inotify (~> 0.9, >= 0.9.10)
208
207
  mercenary (0.3.6)
209
- mini_portile2 (2.8.0)
208
+ mini_portile2 (2.8.1)
210
209
  minima (2.5.1)
211
210
  jekyll (>= 3.5, < 5.0)
212
211
  jekyll-feed (~> 0.9)
213
212
  jekyll-seo-tag (~> 2.1)
214
- minitest (5.15.0)
215
- nokogiri (1.13.6)
213
+ minitest (5.18.0)
214
+ nokogiri (1.14.3)
216
215
  mini_portile2 (~> 2.8.0)
217
216
  racc (~> 1.4)
218
- octokit (4.25.0)
217
+ octokit (4.25.1)
219
218
  faraday (>= 1, < 3)
220
219
  sawyer (~> 0.9)
221
220
  pathutil (0.16.2)
222
221
  forwardable-extended (~> 2.6)
223
222
  public_suffix (4.0.7)
224
- racc (1.6.0)
225
- rb-fsevent (0.11.1)
223
+ racc (1.6.2)
224
+ rb-fsevent (0.11.2)
226
225
  rb-inotify (0.10.1)
227
226
  ffi (~> 1.0)
228
227
  rexml (3.2.5)
@@ -242,16 +241,14 @@ GEM
242
241
  unf (~> 0.1.4)
243
242
  terminal-table (1.8.0)
244
243
  unicode-display_width (~> 1.1, >= 1.1.1)
245
- thread_safe (0.3.6)
246
244
  typhoeus (1.4.0)
247
245
  ethon (>= 0.9.0)
248
- tzinfo (1.2.10)
249
- thread_safe (~> 0.1)
246
+ tzinfo (2.0.6)
247
+ concurrent-ruby (~> 1.0)
250
248
  unf (0.1.4)
251
249
  unf_ext
252
250
  unf_ext (0.0.8.2)
253
251
  unicode-display_width (1.8.0)
254
- zeitwerk (2.5.4)
255
252
 
256
253
  PLATFORMS
257
254
  ruby
package/docs/_config.yml CHANGED
@@ -18,7 +18,7 @@ defaults:
18
18
  values:
19
19
  layout: "example"
20
20
 
21
- jqtree_version: 1.6.3
21
+ jqtree_version: 1.7.1
22
22
 
23
23
  # Build settings
24
24
  markdown: kramdown
@@ -3,6 +3,19 @@ title: Changelog
3
3
  name: changelog
4
4
  ---
5
5
 
6
+ #### 1.7.1 (august 6 2023)
7
+
8
+ - Issue #724: improve accessibility
9
+
10
+ #### 1.7.0 (december 23 2022)
11
+
12
+ Small breaking change: this release changes the definition of getPreviousNode and getNextNode.
13
+
14
+ - Issue #704: dispatch the tree.load_data after initializing the tree
15
+ - Issue #706: change the functions for getting the next and previous nodes.
16
+ - Rename getPreviousNode to getPreviousVisibleNode and getNextNode to getNextVisibleNode.
17
+ - Add new getPreviousNode and getNextNode functions that ignores if a node is visible.
18
+
6
19
  #### 1.6.3 (august 7 2022)
7
20
 
8
21
  - Issue # 692: openFolderDelay is false disables opening folders during drag and drop
@@ -3,7 +3,10 @@ title: getNextNode
3
3
  name: node-functions-getnextnode
4
4
  ---
5
5
 
6
- Get the next node in the tree. Does the same as using the *down* key.
6
+ Get the next node in the tree.
7
+
8
+ - If the node has children, return the first child.
9
+ - If the node is the last child, return the next sibling of the parent.
7
10
 
8
11
  Returns a node or null.
9
12
 
@@ -3,7 +3,7 @@ title: getPreviousNode
3
3
  name: node-functions-getpreviousnode
4
4
  ---
5
5
 
6
- Get the previous node in the tree. Does the same as using the *up* key.
6
+ Return the previous node in the tree.
7
7
 
8
8
  Returns a node or null.
9
9
 
File without changes
@@ -0,0 +1,14 @@
1
+ ---
2
+ title: getPreviousVisibleNode
3
+ name: node-functions-getpreviousvisiblenode
4
+ ---
5
+
6
+ - Get the previous visible node in the tree. Does the same as using the _up_ key.
7
+ - If the previous node is an open parent: return the last child of the node.
8
+ - If the previous node is a closed parent: skip the child nodes of the previous parent, return the previous parent node.
9
+
10
+ Returns a node or null.
11
+
12
+ {% highlight js %}
13
+ var node = node.getPreviousVisibleNode();
14
+ {% endhighlight %}
package/docs/package.json CHANGED
@@ -10,13 +10,13 @@
10
10
  "copy_static": "cp ../tree.jquery.js . && cp ../jqtree.css ."
11
11
  },
12
12
  "devDependencies": {
13
- "@tailwindcss/typography": "^0.5.2",
14
- "autoprefixer": "^10.4.7",
15
- "postcss": "^8.4.14",
16
- "postcss-cli": "^9.1.0",
17
- "postcss-import": "^14.1.0",
13
+ "@tailwindcss/typography": "^0.5.9",
14
+ "autoprefixer": "^10.4.14",
15
+ "postcss": "^8.4.27",
16
+ "postcss-cli": "^10.1.0",
17
+ "postcss-import": "^15.1.0",
18
18
  "postcss-load-config": "^4.0.1",
19
- "postcss-nested": "^5.0.6",
20
- "tailwindcss": "^3.1.2"
19
+ "postcss-nested": "^6.0.1",
20
+ "tailwindcss": "^3.3.3"
21
21
  }
22
22
  }