diff --git a/.editorconfig b/.editorconfig index fe6e86cc..f3ee77cc 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,26 +1,32 @@ -; EditorConfig is awesome: http://EditorConfig.org +# This file is for unifying the coding style for different editors and IDEs +# editorconfig.org -; top-most EditorConfig file root = true -; Unix-style newlines with a newline ending every file [*] -; end_of_line = lf -insert_final_newline = true +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 trim_trailing_whitespace = true +insert_final_newline = true -; 4 space indentation -[*.py] +[*.{json,html,css}] indent_style = space -indent_size = 4 +indent_size = 2 -; Tab indentation (no size specified) [*.js] -; indent_style = tab -indent_style = space +# indent_style = space +# indent_size = 2 +indent_style = tab indent_size = 4 -; Indentation override for all JS under lib directory -[lib/**.js] +[*.coffee] indent_style = space indent_size = 2 + +[*.md] +indent_style = space + +[*.py] +indent_style = space diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..519e888e --- /dev/null +++ b/.eslintignore @@ -0,0 +1,10 @@ +bin +doc +lib +node_modules +test/** +!test/unit/**/*.js +*.min.js +build/** +dist/** +!dist/jquery.js diff --git a/.eslintrc.yaml b/.eslintrc.yaml new file mode 100644 index 00000000..1da635bc --- /dev/null +++ b/.eslintrc.yaml @@ -0,0 +1,113 @@ + +extends: + - "eslint:recommended" + - "jquery" + - "plugin:prettier/recommended" + +# Accept `window`, etc. +env: + browser: true + +# Known globals (`false`: read-only) +globals: + define: false + require: false + module: false + jQuery: false + +# Custom rules (see https://eslint.org/docs/rules/ ) +# 0:off, 1:warn, 2:error +rules: + # --- Best Practices --------------------------------------------------------- + block-scoped-var: warn + # complexity: [warn, 20] + # consistent-return: warn + no-alert: error + no-caller: error + guard-for-in: warn + # linebreak-style: warn + no-else-return: warn + # no-empty-function: warn + no-extend-native: error + no-eval: error + no-floating-decimal: error + no-implied-eval: error + # no-invalid-this: warn + no-labels: warn + no-lone-blocks: warn + no-loop-func: warn + no-new: error + no-new-func: warn + no-new-wrappers: warn + no-octal-escape: warn + no-return-assign: warn + no-script-url: warn + no-self-compare: warn + no-sequences: warn + no-throw-literal: error + no-unmodified-loop-condition: warn + no-unused-expressions: error + # Not enabled because we want to allow `self._superApply(self, args)`: + # no-useless-call: warn + no-useless-catch: warn + no-useless-return: warn + no-with: warn + prefer-promise-reject-errors: warn + radix: error + # vars-on-top: warn + wrap-iife: + - error + - any + yoda: warn + + # --- Strict Mode ------------------------------------------------------------ + # strict: error + + # --- Variables -------------------------------------------------------------- + # init-declarations: ["warn", "always"] + no-label-var: error + # no-shadow: warn + no-shadow-restricted-names: error + no-undef: error + no-undef-init: warn + # no-undefined: warn + no-use-before-define: error + # - error + # - functions: false + + # --- Stylistic Issues ------------------------------------------------------- + camelcase: error + # Not enabled because sometimes we set `node = this`: + # consistent-this: [warn, self] # use `self = this` + func-name-matching: warn + new-cap: + - error + - { "capIsNewExceptionPattern": "^\\$\\.." } # Allow `d = $.Deferred()` + no-bitwise: error + # no-multi-assign: warn + no-negated-condition: warn + no-unneeded-ternary: warn + no-new-object: error + one-var: # see also no-use-before-define + - warn + - consecutive + # one-var-declaration-per-line: warn + + # --- Possible Errors -------------------------------------------------------- + curly: error + eqeqeq: ["error", "always", {"null": "ignore"}] + no-cond-assign: + - error + - except-parens + no-constant-condition: + - error + - { "checkLoops": false } + no-empty: + - error + - {allowEmptyCatch: true} + # no-extra-parens: [warn, all, {conditionalAssign: false }] + no-nested-ternary: warn + no-unused-vars: + - error + # Allow unused vars in catch() and if start with '_' + - {args: none, caughtErrors: none, varsIgnorePattern: "^_" } diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..1ba5573c --- /dev/null +++ b/.gitattributes @@ -0,0 +1,20 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text=auto + +*.css text eol=lf +*.js text eol=lf +*.html text eol=lf +*.md text eol=lf +*.py text eol=lf + +# Explicitly declare text files you want to always be normalized and converted +# to native line endings on checkout. +#*.c text +#*.h text + +# Declare files that will always have CRLF line endings on checkout. +#*.sln text eol=crlf + +# Denote all files that are truly binary and should not be modified. +*.png binary +*.jpg binary diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..21829710 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,9 @@ +# This is a comment. +# Each line is a file pattern followed by one or more owners. + +# ext-grid, scrollbar extension +# /demo/sample-3rd-grid-scrollbar.html @ewya + +# ext-fixed +# /src/jquery.fancytree.fixed.js @Mats0 +# /demo/sample-ext-fixed.html @Mats0 diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000..756a21e3 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,4 @@ +Thanks for contributing :-) + +Please have a look at the +[Contributing Guidelines](https://github.com/mar10/fancytree/wiki/HowtoContribute#report-issues). diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..fb2031cd --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,14 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +# custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] +custom: ['https://www.paypal.com/donate/?hosted_button_id=RA6G29AZRUD44'] diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..f29734ba --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,32 @@ +Thanks for contributing :-) + +Please also read the hints: + https://github.com/mar10/fancytree/wiki/HowtoContribute#report-issues +then remove all unneeded lines from this issue report. + +If you are going to ask a question, please use Stackoverflow instead: + + http://stackoverflow.com/questions/tagged/fancytree + + +### Expected and Actual Behavior + +... (Maybe even a screenshot? Any hints on the browser's debug console?) + + +### Steps to Reproduce the Problem + + 1. ... + 2. ... + +Could you set up a jsFiddle (http://jsfiddle.net/mar10/KcxRd/), +CodePen (https://codepen.io/mar10/pen/WMWrbq), or +Plunker (http://plnkr.co/edit/8sdy3r?p=preview) ? + + +### Environment + + - Browser type and version: + - jQuery and jQuery UI versions: + - Fancytree version: + enabled/affected extensions: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 00000000..28d45975 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,79 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "master" ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "master" ] + schedule: + - cron: '25 14 * * 6' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + paths: + - src + # paths-ignore: + # - src/node_modules + # - '**/*.test.js' + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000..c59f1968 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,43 @@ +# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. +# +# You can adjust the behavior by modifying this file. +# For more information, see: +# https://github.com/actions/stale +name: Mark stale issues and pull requests + +on: + schedule: + - cron: '31 14 * * *' + +jobs: + stale: + + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + + steps: + - uses: actions/stale@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + + days-before-stale: 90 + days-before-close: 14 + exempt-all-milestones: true + operations-per-run: 5 + + stale-issue-label: 'no-issue-activity' + exempt-issue-labels: 'pinned,security' + stale-issue-message: | + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. + Thank you for your contributions. + close-issue-reason: 'not_planned' + + stale-pr-label: 'no-pr-activity' + exempt-pr-labels: 'pinned,security' + stale-pr-message: | + This pull request has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. + Thank you for your contributions. diff --git a/.gitignore b/.gitignore index 47734c15..ef122ab3 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,10 @@ /doc/jsdoc_new /doc/jsdoc_old /node_modules +/doc/screenshots +/src/skin-custom-* *.log sauce_connect.* -/doc/screenshots +.pyftpsync-meta.json +.DS_Store +test/ajax_101k.json diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 23a84015..00000000 --- a/.jshintrc +++ /dev/null @@ -1,29 +0,0 @@ - -{ - "bitwise": true, - "camelcase": true, - "curly": true, - "eqeqeq": true, - "expr": true, - "immed": true, - "latedef": true, - "newcap": true, - "noarg": true, - "nonew": true, - "onevar": true, - "quotmark": "double", - "trailing": true, - "undef": true, - "unused": "vars", - - "boss": true, - "eqnull": true, - "evil": false, - "smarttabs": true, - - "browser": true, - "globals": { - "define": true, - "jQuery": true - } -} diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..c4d6ec75 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,27 @@ +# Style guide rationale: +# Width 80 is default (and explicitly recommended) by prettier +# - 2 space indentation and trailing semicolons seem to be most popular +# https://hackernoon.com/what-javascript-code-style-is-the-most-popular-5a3f5bec1f6f +# It is also the prettier's default +# - Double quotes are default in prettier and mandatory in Black +# - Trailing comma produces smaller diffs +# BUT: +# As a first step, we keep the current whitespace setting: +# - use tabs +# - tabWitdh 4 + +printWidth: 80 +useTabs: true +tabWidth: 4 +# useTabs: false +# tabWidth: 2 +semi: true +singleQuote: false +trailingComma: "es5" +bracketSpacing: true # because it's prettier's default +#requirePragma: true + +#overrides: +# - files: "*.test.js" +# options: +# semi: true diff --git a/.travis.yml b/.travis.yml index b37e4211..f1e168b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,25 @@ language: node_js +sudo: false node_js: - - 0.10 + - "10" + before_script: - npm install -g grunt-cli -script: grunt travis --verbose + +addons: + hosts: + - travis.dev + - localhost + +matrix: + include: + - env: GRUNT_TASK=travis + # - env: GRUNT_TASK=travis-optional + # allow_failures: + # - env: GRUNT_TASK=travis-optional + +script: grunt $GRUNT_TASK --verbose + env: global: - secure: VmlzKmxE+V+QZpvDuj5W41u2HTu2uTvW0aUi2p+2yhCHd7J5TFdOoECwIhTa/4VDEpnZwjLJXPd2q9kEn3+G0HpEqRMtKVTP/sM8y0JKUkprSCWV/y+pVX+0B9jQBAhEcjtkLDEGI3xVI8n+WV0Fig4kWecSCcSSUN5Mlbq5glQ= diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..2ba986f6 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "chrome", + "request": "launch", + "name": "Launch Chrome against localhost", + "url": "http://localhost:8080", + "webRoot": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/3rd-party/extensions/contextmenu/contextmenu.html b/3rd-party/extensions/contextmenu/contextmenu.html index 26aff702..00fbced5 100644 --- a/3rd-party/extensions/contextmenu/contextmenu.html +++ b/3rd-party/extensions/contextmenu/contextmenu.html @@ -4,71 +4,76 @@