diff --git a/.browserslistrc b/.browserslistrc new file mode 100644 index 00000000..53565ed3 --- /dev/null +++ b/.browserslistrc @@ -0,0 +1,3 @@ +> 0.25% +ie 11 +not dead \ No newline at end of file diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 00000000..ab322f57 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,35 @@ +{ + "parser": "@babel/eslint-parser", + "extends": "eslint:recommended", + "plugins": [ + "react" + ], + "ignorePatterns": ["build/**/*.js"], + "rules": { + "strict": 0, + "quotes": [1, "single"], + "curly": [1, "multi-line"], + "camelcase": 0, + "comma-dangle": 0, + "no-console": 2, + "no-use-before-define": [1, "nofunc"], + "no-underscore-dangle": 0, + "no-unused-vars": [1, {ignoreRestSiblings: true}], + "new-cap": 0, + "prefer-const": 1, + "semi": 1 + }, + env: { + "browser": true, + "node": true + }, + globals: { + // For Flow + "ReactElement", + "ReactClass", + "$Exact", + "Partial", + "$Keys", + "MouseTouchEvent", + } +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..629ef6dc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,102 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'yarn' + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Lint + run: yarn lint + + test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20, 22, 24] + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + + - name: Install dependencies + run: yarn install --frozen-lockfile + + # The typeCompat tsc compile is Node-version-independent; skip it on every + # non-primary matrix node so the full source type graph is compiled once, + # not three times. All other unit tests still run on every Node version. + - name: Run unit tests + env: + SKIP_TSC_TYPE_COMPAT: ${{ matrix.node-version != 20 && '1' || '' }} + run: yarn test + + # The build (tsup --dts + webpack) recompiles the full type graph for + # declaration emit; that output is byte-identical across Node versions, so + # building on every matrix entry just recompiles the same type graph N times. + # Gate it to the primary Node version. Unit tests still run on all versions. + - name: Build + if: matrix.node-version == 20 + run: yarn build + + test-browser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'yarn' + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Build + run: yarn build + + - name: Run browser tests + run: yarn test:browser + + coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'yarn' + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Run tests with coverage + run: yarn test:coverage + + # NOTE: the standalone TypeScript checks (`tsc --noEmit` for source and + # `tsc -p typings` for the public .d.ts) are already run by `make lint` in the + # `lint` job above. Running them again here recompiled the full type graph a + # second time every CI run for no added coverage, so this job was removed and + # `lint` is the single owner of type-checking. Re-add a dedicated job only if + # `make lint` ever stops invoking tsc. diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 00000000..69ac766a --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,26 @@ +name: Build and Deploy to GitHub Pages +permissions: + contents: write +on: + push: + tags: + - "*" + workflow_dispatch: +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v4 + + - name: Install and Build + run: | + yarn + yarn build + yarn build-example + + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages # The branch the action should deploy to. + folder: example # The folder the action should deploy. diff --git a/.gitignore b/.gitignore index cf9cb086..8408429a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ .idea *.iml node_modules/ +build/ +example/build/ +coverage/ diff --git a/.npmignore b/.npmignore deleted file mode 100644 index a3890379..00000000 --- a/.npmignore +++ /dev/null @@ -1,7 +0,0 @@ -**/.* -example -script -specs -bower.json -karma.conf.js -webpack.config.js diff --git a/.travis.yml b/.travis.yml index c45d3385..e5838902 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,18 @@ language: node_js node_js: - - "0.10" -before_script: - - export DISPLAY=:99.0 - - sh -e /etc/init.d/xvfb start + - "10" + - "12" + - "node" # latest +cache: yarn +env: + - MOZ_HEADLESS=1 +addons: + firefox: latest +script: + - make lint + - make test + - make test-phantom email: on_failure: change on_success: never + diff --git a/CHANGELOG.md b/CHANGELOG.md index 1220b5b6..b30fcef3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,578 @@ # Changelog -### 0.1.0 (Jul 25, 2014) +### 4.7.1 (Jul 28, 2026) -- Initial release +- Fix: props are no longer marked required under React 18 TypeScript. Regression in 4.6.0. The `propTypes` static was a required member of the public type; React 18's JSX `LibraryManagedAttributes` consults `propTypes` when it is required, and doing so cancels the optionality `defaultProps` normally grants. React 19 ignores `propTypes`, which is why the v19-only type check missed it. `make lint` now also type-checks the public surface against `@types/react@18`. ([#809](https://github.com/react-grid-layout/react-draggable/pull/809), closes [#807](https://github.com/react-grid-layout/react-draggable/issues/807)) +- Fix: guard the `process` access in the debug logger so browser bundlers that do not shim `process` no longer crash on import. ([#810](https://github.com/react-grid-layout/react-draggable/pull/810), closes [#806](https://github.com/react-grid-layout/react-draggable/issues/806)) -### 0.1.1 (Jul 26, 2014) +### 4.7.0 (Jun 18, 2026) -- Fixing dragging not stopping on mouseup in some cases +- Feature: add a `nonce` prop to support a strict Content Security Policy. It's applied to the dynamically-injected user-select ` + + +