[
  {
    "path": ".eslintignore",
    "content": "dist/*\r\ndemo/*\r\nspec/*\r\n"
  },
  {
    "path": ".eslintrc.js",
    "content": "module.exports = {\n  parser: '@typescript-eslint/parser',\n  env: {\n    browser: true,\n    commonjs: true,\n    es6: true,\n    node: true\n  },\n  extends: [\n    'plugin:@typescript-eslint/recommended'\n  ],\n  parserOptions: {\n    ecmaVersion: 2020,\n    sourceType: 'module'\n  },\n  rules: {\n    'indent': ['error', 2],\n    'max-len': ['error', 180],\n    'no-trailing-spaces': 1,\n    'prefer-const': 0,\n    '@typescript-eslint/ban-ts-comment': 0,\n    'max-len': 0\n  }\n};\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "# These are supported funding model platforms\n\ngithub: [adumesny]\npatreon: # Replace with a single Patreon username\nopen_collective: # Replace with a single Open Collective username\nko_fi: # Replace with a single Ko-fi username\ntidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel\ncommunity_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry\nliberapay: # Replace with a single Liberapay username\nissuehunt: # Replace with a single IssueHunt username\notechie: # Replace with a single Otechie username\ncustom: ['https://www.paypal.me/alaind831', 'https://www.venmo.com/adumesny'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: bug report\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n## Subject of the issue\nDescribe your issue here.\nIf unsure if lib bug, use slack channel instead: https://join.slack.com/t/gridstackjs/shared_invite/zt-3978nsff6-HDNE_N45DydP36NBSV9JFQ\n\n## Your environment\n* version of gridstack.js - DON'T SAY LATEST as that doesn't mean anything a month/year from now.\n* which browser/OS\n\n## Steps to reproduce\nYou **MUST** provide a working demo - keep it simple and avoid frameworks as that could have issues - you can use \n\nplain html: https://stackblitz.com/edit/gridstack-demo\nAngular: https://stackblitz.com/edit/gridstack-angular\n\nplease don't use [jsfiddle.net](https://jsfiddle.net/adumesny/jqhkry7g) as my work now blocks that website.\n\n\n## Expected behavior\nTell us what should happen. If hard to describe, attach a video as well.\n"
  },
  {
    "path": ".github/workflows/deploy-docs.yml",
    "content": "name: Deploy Documentation\n\non:\n  push:\n    branches: [ master ]\n  # Allow manual triggering\n  workflow_dispatch:\n\njobs:\n  deploy-docs:\n    runs-on: ubuntu-latest\n    # Only run on pushes to master (not PRs)\n    if: github.ref == 'refs/heads/master'\n    \n    steps:\n    - name: Checkout repository\n      uses: actions/checkout@v4\n      with:\n        fetch-depth: 0\n\n    - name: Setup Node.js\n      uses: actions/setup-node@v4\n      with:\n        node-version: '20'\n        cache: 'yarn'\n\n    - name: Install main dependencies\n      run: yarn install\n\n    - name: Install Angular dependencies\n      run: |\n        cd angular\n        yarn install\n\n    - name: Build Angular library\n      run: yarn build:ng\n\n    - name: Build main library\n      run: |\n        grunt\n        webpack\n        tsc --project tsconfig.docs.json --stripInternal\n\n    - name: Generate all documentation\n      run: yarn doc\n\n    - name: Prepare deployment structure\n      run: |\n        mkdir -p deploy\n        \n        # Create proper directory structure for GitHub Pages\n        mkdir -p deploy/doc/html\n        mkdir -p deploy/angular/doc/html\n        \n        # Debug: Check what was generated\n        echo \"📁 Checking generated documentation...\"\n        echo \"Main library HTML docs:\"\n        if [ -d \"doc/html\" ]; then\n          echo \"  ✓ doc/html/ exists\"\n          ls -la doc/html/ | head -10\n        else\n          echo \"  ✗ doc/html/ NOT FOUND\"\n        fi\n        \n        echo \"Angular library HTML docs:\"\n        if [ -d \"angular/doc/html\" ]; then\n          echo \"  ✓ angular/doc/html/ exists\"\n          ls -la angular/doc/html/ | head -10\n        else\n          echo \"  ✗ angular/doc/html/ NOT FOUND\"\n        fi\n        \n        echo \"Angular library Markdown docs (should NOT be deployed):\"\n        if [ -d \"angular/doc/api\" ]; then\n          echo \"  ⚠ angular/doc/api/ exists (will NOT be copied to deployment)\"\n          ls -la angular/doc/api/ | head -10\n        else\n          echo \"  ✓ angular/doc/api/ does not exist\"\n        fi\n        \n        # Copy main library HTML documentation\n        if [ -d \"doc/html\" ]; then\n          cp -r doc/html/* deploy/doc/html/\n          echo \"✓ Copied main library HTML docs\"\n        else\n          echo \"⚠ Warning: Main library HTML docs not found, skipping...\"\n        fi\n        \n        # Copy Angular library HTML documentation  \n        if [ -d \"angular/doc/html\" ]; then\n          cp -r angular/doc/html/* deploy/angular/doc/html/\n          echo \"✓ Copied Angular library HTML docs\"\n        else\n          echo \"⚠ Warning: Angular library HTML docs not found, skipping...\"\n        fi\n        \n        # Note: Do NOT copy or create index.html at root\n        # The gh-pages branch has its own index.html that should be preserved\n        # The keep_files: true option will preserve existing files on gh-pages\n        \n        # Ensure .nojekyll exists to prevent Jekyll processing\n        touch deploy/.nojekyll\n        \n        # Final verification\n        echo \"\"\n        echo \"📦 Deployment structure:\"\n        find deploy -type f -name \"*.html\" | head -20\n    \n    - name: Preserve gh-pages root index.html\n      run: |\n        # Fetch gh-pages to get existing index.html if we didn't create one\n        if [ ! -f \"deploy/index.html\" ]; then\n          echo \"📄 No index.html in deploy, fetching from gh-pages...\"\n          git fetch origin gh-pages:gh-pages 2>/dev/null || true\n          \n          # Check out just the index.html from gh-pages if it exists\n          if git show origin/gh-pages:index.html > /dev/null 2>&1; then\n            git show origin/gh-pages:index.html > deploy/index.html\n            echo \"✓ Preserved existing index.html from gh-pages\"\n          else\n            echo \"ℹ No index.html on gh-pages to preserve\"\n          fi\n        else\n          echo \"ℹ index.html already in deploy directory, not fetching from gh-pages\"\n        fi\n\n    - name: Deploy to GitHub Pages\n      uses: peaceiris/actions-gh-pages@v4\n      with:\n        github_token: ${{ secrets.GITHUB_TOKEN }}\n        publish_dir: ./deploy\n        # Force clean deployment - creates orphan branch to remove ALL old files\n        force_orphan: true\n        commit_message: 'Deploy documentation from ${{ github.sha }}'\n"
  },
  {
    "path": ".github/workflows/sync-docs.yml",
    "content": "name: Sync Documentation to gh-pages\n\non:\n  push:\n    branches: [master, develop]\n    paths:\n      - 'doc/html/**'\n      - 'angular/doc/**'\n      - '.github/workflows/sync-docs.yml'\n  workflow_dispatch:\n\njobs:\n  sync-docs:\n    runs-on: ubuntu-latest\n    if: github.repository == 'adumesny/gridstack.js'\n    \n    steps:\n    - name: Checkout master branch\n      uses: actions/checkout@v4\n      with:\n        ref: master\n        fetch-depth: 0\n        token: ${{ secrets.GITHUB_TOKEN }}\n\n    - name: Configure Git\n      run: |\n        git config --global user.name 'github-actions[bot]'\n        git config --global user.email 'github-actions[bot]@users.noreply.github.com'\n\n    - name: Check if docs exist\n      id: check-docs\n      run: |\n        echo \"🔍 Checking for documentation directories on master branch...\"\n        \n        if [ -d \"doc/html\" ]; then\n          echo \"  ✓ doc/html/ exists\"\n          echo \"main_docs=true\" >> $GITHUB_OUTPUT\n        else\n          echo \"  ✗ doc/html/ NOT FOUND\"\n          echo \"main_docs=false\" >> $GITHUB_OUTPUT\n        fi\n        \n        if [ -d \"angular/doc/html\" ]; then\n          echo \"  ✓ angular/doc/html/ exists\"\n          echo \"angular_docs=true\" >> $GITHUB_OUTPUT\n        else\n          echo \"  ✗ angular/doc/html/ NOT FOUND\"\n          echo \"angular_docs=false\" >> $GITHUB_OUTPUT\n        fi\n        \n        if [ -d \"angular/doc/api\" ]; then\n          echo \"  ℹ angular/doc/api/ exists (Markdown - will NOT be synced)\"\n        fi\n        \n        echo \"\"\n        echo \"Sync decisions:\"\n        echo \"  Main library HTML: $([ -d 'doc/html' ] && echo 'YES' || echo 'NO')\"\n        echo \"  Angular library HTML: $([ -d 'angular/doc/html' ] && echo 'YES' || echo 'NO')\"\n\n    - name: Checkout gh-pages branch\n      if: steps.check-docs.outputs.main_docs == 'true' || steps.check-docs.outputs.angular_docs == 'true'\n      run: |\n        git fetch origin gh-pages\n        git checkout gh-pages\n\n    - name: Sync main library documentation\n      if: steps.check-docs.outputs.main_docs == 'true'\n      run: |\n        echo \"Syncing main library documentation...\"\n        \n        # Remove existing doc/html directory if it exists\n        if [ -d \"doc/html\" ]; then\n          rm -rf doc/html\n        fi\n        \n        # Extract docs from master branch using git archive\n        mkdir -p doc\n        git archive master doc/html | tar -xf -\n        \n        # Add changes\n        git add doc/html\n\n    - name: Sync Angular documentation\n      if: steps.check-docs.outputs.angular_docs == 'true'\n      run: |\n        echo \"Syncing Angular library documentation...\"\n        \n        # Remove existing Angular HTML docs if they exist\n        if [ -d \"angular/doc/html\" ]; then\n          rm -rf angular/doc/html\n        fi\n        \n        # Extract Angular HTML docs from master branch using git archive\n        mkdir -p angular/doc\n        git archive master angular/doc/html | tar -xf -\n        \n        # Add changes\n        git add -f angular/doc/html\n\n    - name: Commit and push changes\n      if: steps.check-docs.outputs.main_docs == 'true' || steps.check-docs.outputs.angular_docs == 'true'\n      run: |\n        # Check if there are changes to commit\n        if git diff --staged --quiet; then\n          echo \"No documentation changes to sync\"\n          exit 0\n        fi\n        \n        # Create commit message\n        COMMIT_MSG=\"📚 Auto-sync documentation from master\"\n        if [ \"${{ steps.check-docs.outputs.main_docs }}\" == \"true\" ]; then\n          COMMIT_MSG=\"${COMMIT_MSG}%0A%0A- Updated main library HTML docs (doc/html/)\"\n        fi\n        if [ \"${{ steps.check-docs.outputs.angular_docs }}\" == \"true\" ]; then\n          COMMIT_MSG=\"${COMMIT_MSG}%0A%0A- Updated Angular library HTML docs (angular/doc/html/)\"\n        fi\n        \n        COMMIT_MSG=\"${COMMIT_MSG}%0A%0ASource: ${{ github.sha }}\"\n        \n        # Decode URL-encoded newlines for the commit message\n        COMMIT_MSG=$(echo -e \"${COMMIT_MSG//%0A/\\\\n}\")\n        \n        # Commit and push\n        git commit -m \"$COMMIT_MSG\"\n        git push origin gh-pages\n        \n        echo \"✅ Documentation synced to gh-pages successfully!\"\n"
  },
  {
    "path": ".gitignore",
    "content": "*.log\n*.tgz\n*.zip\n.npmrc\ncoverage\ndist\ndist_save\nnode_modules\n.vscode\n.idea/\n.DS_Store\ndoc/html/\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: node_js\nnode_js:\n- 10.19.0\ndist: trusty\nsudo: required\naddons:\n  chrome: stable\n#before_install:\n#- yarn global add protractor@3.3.0\ncache:\n  directories:\n    - node_modules\ninstall:\n#- yarn global add npm@6.0.1\n- yarn global add grunt-cli\n#- yarn add selenium-webdriver\n- yarn\n#- ./node_modules/protractor/bin/webdriver-manager update --standalone\n#before_script:\n#- export CHROME_BIN=chromium-browser\n#- export DISPLAY=:99.0\n#- sh -e /etc/init.d/xvfb start\nscript:\n- yarn build\n- yarn test\n# - grunt e2e-test\nnotifications:\n  slack:\n    secure: iGLGsYyVIyKVpVVCskGh/zc6Pkqe0D7jpUtbywSbnq6l5seE6bvBVqm0F2FSCIN+AIC+qal2mPEWysDVsLACm5tTEeA8NfL8dmCrAKbiFbi+gHl4mnHHCHl7ii/7UkoIIXNc5UXbgMSXRS5l8UcsSDlN8VxC5zWstbJvjeYIvbA=\n"
  },
  {
    "path": ".vitestrc.coverage.ts",
    "content": "/// <reference types=\"vitest\" />\nimport { defineConfig } from 'vitest/config'\n\n// Enhanced coverage configuration\nexport default defineConfig({\n  test: {\n    globals: true,\n    environment: 'jsdom',\n    setupFiles: ['./vitest.setup.ts'],\n    \n    include: [\n      'spec/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',\n      'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'\n    ],\n    \n    exclude: [\n      '**/node_modules/**',\n      '**/dist/**',\n      '**/angular/**',\n      '**/react/**',\n      '**/demo/**'\n    ],\n\n    // Enhanced coverage configuration for detailed reporting\n    coverage: {\n      provider: 'v8',\n      reporter: [\n        'text',\n        'text-summary', \n        'json',\n        'json-summary',\n        'html',\n        'lcov',\n        'clover',\n        'cobertura'\n      ],\n      \n      // Comprehensive exclusion patterns\n      exclude: [\n        'coverage/**',\n        'dist/**',\n        'node_modules/**',\n        'demo/**',\n        'angular/**',\n        'react/**',\n        'scripts/**',\n        'spec/e2e/**',\n        '**/*.d.ts',\n        '**/*.config.{js,ts}',\n        '**/karma.conf.js',\n        '**/vitest.config.ts',\n        '**/vitest.setup.ts',\n        '**/webpack.config.js',\n        '**/Gruntfile.js',\n        '**/*.min.js',\n        '**/test.html'\n      ],\n      \n      // Include all source files for coverage analysis\n      all: true,\n      include: ['src/**/*.{js,ts}'],\n      \n      // Strict coverage thresholds\n      thresholds: {\n        global: {\n          branches: 85,\n          functions: 85,\n          lines: 85,\n          statements: 85\n        },\n        // Per-file thresholds for critical files\n        'src/gridstack.ts': {\n          branches: 90,\n          functions: 90,\n          lines: 90,\n          statements: 90\n        },\n        'src/gridstack-engine.ts': {\n          branches: 90,\n          functions: 90,\n          lines: 90,\n          statements: 90\n        },\n        'src/utils.ts': {\n          branches: 85,\n          functions: 85,\n          lines: 85,\n          statements: 85\n        }\n      },\n      \n      // Coverage report directory\n      reportsDirectory: './coverage',\n      \n      // Enable branch coverage\n      reportOnFailure: true,\n      \n      // Clean coverage directory before each run\n      clean: true,\n      \n      // Skip files with no coverage\n      skipFull: false,\n      \n      // Enable source map support for accurate line mapping\n      allowExternal: false,\n      \n      // Watermarks for coverage coloring\n      watermarks: {\n        statements: [50, 80],\n        functions: [50, 80], \n        branches: [50, 80],\n        lines: [50, 80]\n      }\n    },\n\n    // Enhanced reporter configuration\n    reporter: [\n      'verbose',\n      'html',\n      'json',\n      'junit'\n    ],\n\n    // Output files for CI/CD integration\n    outputFile: {\n      html: './coverage/test-results.html',\n      json: './coverage/test-results.json',\n      junit: './coverage/junit-report.xml'\n    }\n  }\n})\n"
  },
  {
    "path": "Gruntfile.js",
    "content": "module.exports = function(grunt) {\r\n  grunt.loadNpmTasks('grunt-sass');\r\n  grunt.loadNpmTasks('grunt-contrib-cssmin');\r\n  grunt.loadNpmTasks('grunt-contrib-copy');\r\n  // grunt.loadNpmTasks('grunt-contrib-uglify');\r\n  grunt.loadNpmTasks('grunt-eslint');\r\n  grunt.loadNpmTasks('grunt-contrib-watch');\r\n  grunt.loadNpmTasks('grunt-protractor-runner');\r\n  grunt.loadNpmTasks('grunt-contrib-connect');\r\n  grunt.loadNpmTasks('grunt-protractor-webdriver');\r\n\r\n  const sass = require('sass');\r\n\r\n  grunt.initConfig({\r\n    sass: {\r\n      options: {\r\n        // precision: 3, // doesn't work\r\n        implementation: sass,\r\n\t\t\t  sourceMap: false\r\n      },\r\n      dist: {\r\n        files: {\r\n          'dist/gridstack.css': 'src/gridstack.scss',\r\n        }\r\n      }\r\n    },\r\n    cssmin: {\r\n      dist: {\r\n        options: {\r\n          sourceMap: false,\r\n          keepSpecialComments: '*'\r\n        },\r\n        files: {\r\n          'dist/gridstack.min.css': ['dist/gridstack.css'],\r\n        }\r\n      }\r\n    },\r\n    copy: {\r\n      dist: {\r\n        files: {\r\n          'dist/angular/README.md': ['angular/README.md'],\r\n          'dist/angular/src/gridstack.component.ts': ['angular/projects/lib/src/lib/gridstack.component.ts'],\r\n          'dist/angular/src/gridstack-item.component.ts': ['angular/projects/lib/src/lib/gridstack-item.component.ts'],\r\n          'dist/angular/src/base-widget.ts': ['angular/projects/lib/src/lib/base-widget.ts'],\r\n          'dist/angular/src/gridstack.module.ts': ['angular/projects/lib/src/lib/gridstack.module.ts'],\r\n          'dist/angular/src/types.ts': ['angular/projects/lib/src/lib/types.ts'],\r\n        }\r\n      }\r\n    },\r\n    // uglify: {\r\n    //   options: {\r\n    //     sourceMap: true,\r\n    //     output: {\r\n    //       comments: 'some'\r\n    //     }\r\n    //   },\r\n    //   dist: {\r\n    //     files: {\r\n    //     }\r\n    //   }\r\n    // },\r\n    eslint: {\r\n      target: ['*.js', 'src/*.js']\r\n    },\r\n\r\n    watch: {\r\n      scripts: {\r\n        files: ['src/*.js'],\r\n        tasks: ['copy', 'uglify'],\r\n        options: {\r\n        },\r\n      },\r\n      styles: {\r\n        files: ['src/*.scss'],\r\n        tasks: ['sass', 'cssmin'],\r\n        options: {\r\n        },\r\n      }\r\n    },\r\n\r\n    protractor: {\r\n      options: {\r\n        configFile: 'protractor.conf.js',\r\n      },\r\n      all: {}\r\n    },\r\n\r\n    connect: {\r\n      all: {\r\n        options: {\r\n          port: 8080,\r\n          hostname: 'localhost',\r\n          base: '.',\r\n        },\r\n      },\r\n    },\r\n\r\n    // eslint-disable-next-line @typescript-eslint/camelcase\r\n    protractor_webdriver: {\r\n      all: {\r\n        options: {\r\n          command: 'webdriver-manager start',\r\n        }\r\n      }\r\n    }\r\n  });\r\n\r\n  grunt.registerTask('lint', ['eslint']);\r\n  grunt.registerTask('default', ['sass', 'cssmin', /*'eslint',*/ 'copy', /*'uglify'*/]);\r\n  grunt.registerTask('e2e-test', ['connect', 'protractor_webdriver', 'protractor']);\r\n};\r\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2019-2025 Alain Dumesny. v0.4.0 and older (c) 2014-2018 Pavel Reznikov, Dylan Weiss\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "PULL_REQUEST_TEMPLATE.md",
    "content": "### Description\nPlease explain the changes you made here. Include an example of what your changes fix or how to use the changes.\n\n### Checklist\n- [ ] Created tests which fail without the change (if possible)\n- [ ] All tests passing (`yarn test`)\n- [ ] Extended the README / documentation, if necessary\n"
  },
  {
    "path": "README.md",
    "content": "# gridstack.js\n\n[![NPM version](https://img.shields.io/npm/v/gridstack.svg)](https://www.npmjs.com/package/gridstack)\n[![Coverage Status](https://coveralls.io/repos/github/gridstack/gridstack.js/badge.svg?branch=develop)](https://coveralls.io/github/gridstack/gridstack.js?branch=develop)\n[![downloads](https://img.shields.io/npm/dm/gridstack.svg)](https://www.npmjs.com/package/gridstack)\n\nMobile-friendly modern Typescript library for dashboard layout and creation. Making a drag-and-drop, multi-column responsive dashboard has never been easier. Has multiple bindings and works great with [Angular](https://angular.io/) (included), [React](https://reactjs.org/), [Vue](https://vuejs.org/), [Knockout.js](http://knockoutjs.com), [Ember](https://www.emberjs.com/) and others (see [frameworks](#specific-frameworks) section).\n\nInspired by no-longer maintained gridster, built with love.\n\nCheck http://gridstackjs.com and [these demos](http://gridstackjs.com/demo/).\n\nIf you find this lib useful, please donate [PayPal](https://www.paypal.me/alaind831) (use **“send to a friend”** to avoid 3% fee) or [Venmo](https://www.venmo.com/adumesny) (adumesny) and help support it!\n\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/alaind831)\n[![Donate](https://img.shields.io/badge/Donate-Venmo-g.svg)](https://www.venmo.com/adumesny)\n\nJoin us on Slack: [https://gridstackjs.slack.com](https://join.slack.com/t/gridstackjs/shared_invite/zt-3978nsff6-HDNE_N45DydP36NBSV9JFQ)\n\n<!-- [![Slack Status](https://gridstackjs.com/badge.svg)](https://gridstackjs.slack.com) -->\n<!-- START doctoc generated TOC please keep comment here to allow auto update -->\n<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->\n**Table of Contents**  *generated with [DocToc](http://doctoc.herokuapp.com/)*\n\n- [Demo and API Documentation](#demo-and-api-documentation)\n- [Usage](#usage)\n  - [Install](#install)\n  - [Include](#include)\n  - [Basic usage](#basic-usage)\n  - [Requirements](#requirements)\n  - [Specific frameworks](#specific-frameworks)\n  - [Extend Library](#extend-library)\n  - [Extend Engine](#extend-engine)\n  - [Change grid columns](#change-grid-columns)\n  - [Custom columns CSS (OLD, not needed with v12+)](#custom-columns-css-old-not-needed-with-v12)\n  - [Override resizable/draggable options](#override-resizabledraggable-options)\n  - [Touch devices support](#touch-devices-support)\n- [Migrating](#migrating)\n  - [Migrating to v0.6](#migrating-to-v06)\n  - [Migrating to v1](#migrating-to-v1)\n  - [Migrating to v2](#migrating-to-v2)\n  - [Migrating to v3](#migrating-to-v3)\n  - [Migrating to v4](#migrating-to-v4)\n  - [Migrating to v5](#migrating-to-v5)\n  - [Migrating to v6](#migrating-to-v6)\n  - [Migrating to v7](#migrating-to-v7)\n  - [Migrating to v8](#migrating-to-v8)\n  - [Migrating to v9](#migrating-to-v9)\n  - [Migrating to v10](#migrating-to-v10)\n  - [Migrating to v11](#migrating-to-v11)\n  - [Migrating to v12](#migrating-to-v12)\n- [jQuery Application](#jquery-application)\n- [Changes](#changes)\n- [Usage Trend](#usage-trend)\n- [The Team](#the-team)\n\n<!-- END doctoc generated TOC please keep comment here to allow auto update -->\n\n\n# Demo and API Documentation\n\nPlease visit http://gridstackjs.com and [these demos](http://gridstackjs.com/demo/), and complete [API documentation](https://gridstack.github.io/gridstack.js/doc/html/) ([markdown](https://github.com/gridstack/gridstack.js/tree/master/doc/API.md))\n\n# Usage\n\n## Install\n[![NPM version](https://img.shields.io/npm/v/gridstack.svg)](https://www.npmjs.com/package/gridstack)\n\n```js\nyarn add gridstack\n// or\nnpm install --save gridstack\n```\n\n## Include\n\nES6 or Typescript\n\n```js\nimport 'gridstack/dist/gridstack.min.css';\nimport { GridStack } from 'gridstack';\n```\n\nAlternatively (single combined file, notice the -all.js) in html\n\n```html\n<link href=\"node_modules/gridstack/dist/gridstack.min.css\" rel=\"stylesheet\"/>\n<script src=\"node_modules/gridstack/dist/gridstack-all.js\"></script>\n```\n\n**Note**: IE support was dropped in v2, but restored in v4.4 by an external contributor (I have no interest in testing+supporting obsolete browser so this likely will break again in the future) and DROPPED again in v12 (css variable needed).\nYou can use the es5 files and polyfill (larger) for older browser instead. For example:\n```html\n<link href=\"node_modules/gridstack/dist/gridstack.min.css\" rel=\"stylesheet\"/>\n<script src=\"node_modules/gridstack/dist/es5/gridstack-poly.js\"></script>\n<script src=\"node_modules/gridstack/dist/es5/gridstack-all.js\"></script>\n```\n\n\n## Basic usage\n\ncreating items dynamically...\n\n```js\n// ...in your HTML\n<div class=\"grid-stack\"></div>\n\n// ...in your script\nvar grid = GridStack.init();\ngrid.addWidget({w: 2, content: 'item 1'});\n```\n\n... or creating from list\n\n```js\n// using serialize data instead of .addWidget()\nconst serializedData = [\n  {x: 0, y: 0, w: 2, h: 2},\n  {x: 2, y: 3, w: 3, content: 'item 2'},\n  {x: 1, y: 3}\n];\n\ngrid.load(serializedData);\n```\n\n... or DOM created items\n\n```js\n// ...in your HTML\n<div class=\"grid-stack\">\n  <div class=\"grid-stack-item\">\n    <div class=\"grid-stack-item-content\">Item 1</div>\n  </div>\n  <div class=\"grid-stack-item\" gs-w=\"2\">\n    <div class=\"grid-stack-item-content\">Item 2 wider</div>\n  </div>\n</div>\n\n// ...in your script\nGridStack.init();\n```\n\n...or see list of all [API and options](https://github.com/gridstack/gridstack.js/tree/master/doc) available.\n\nsee [stackblitz sample](https://stackblitz.com/edit/gridstack-demo) as running example too.\n\n## Requirements\n\nGridStack no longer requires external dependencies as of v1 (lodash was removed in v0.5 and jquery API in v1). v3 is a complete HTML5 re-write removing need for jquery. v6 is native mouse and touch event for mobile support, and no longer have jquery-ui version. All you need to include now is `gridstack-all.js` and `gridstack.min.css` (layouts are done using CSS column based %).\n\n## Specific frameworks\n\nsearch for ['gridstack' under NPM](https://www.npmjs.com/search?q=gridstack&ranking=popularity) for latest, more to come...\n\n- **Angular**: we ship out of the box an Angular wrapper - see <a href=\"https://github.com/gridstack/gridstack.js/tree/master/angular\" target=\"_blank\">Angular Component</a>.\n- **Angular9**: [lb-gridstack](https://github.com/pfms84/lb-gridstack) Note: very old v0.3 gridstack instance so recommend for **concept ONLY if you wish to use directive instead**. Code has **not been vented** at as I use components.\n- **AngularJS**: [gridstack-angular](https://github.com/kdietrich/gridstack-angular)\n- **Ember**: [ember-gridstack](https://github.com/yahoo/ember-gridstack)\n- **knockout**: see [demo](https://gridstackjs.com/demo/knockout.html) using component, but check [custom bindings ticket](https://github.com/gridstack/gridstack.js/issues/465) which is likely better approach.\n- **Rails**: [gridstack-js-rails](https://github.com/randoum/gridstack-js-rails)\n- **React**: work in progress to have wrapper code: see <a href=\"https://github.com/gridstack/gridstack.js/tree/master/react\" target=\"_blank\">React Component</a>. But also see [demo](https://gridstackjs.com/demo/react.html) with [src](https://github.com/gridstack/gridstack.js/tree/master/demo/react.html), or  [react-gridstack-example](https://github.com/Inder2108/react-gridstack-example/tree/master/src/App.js), or read on what [hooks to use](https://github.com/gridstack/gridstack.js/issues/735#issuecomment-329888796)\n- **Vue**: see [demo](https://gridstackjs.com/demo/vue3js.html) with [v3 src](https://github.com/gridstack/gridstack.js/tree/master/demo/vue3js.html) or [v2 src](https://github.com/gridstack/gridstack.js/tree/master/demo/vue2js.html)\n- **Aurelia**: [aurelia-gridstack](https://github.com/aurelia-ui-toolkits/aurelia-gridstack), see [demo](https://aurelia-ui-toolkits.github.io/aurelia-gridstack/)\n\n## Extend Library\n\nYou can easily extend or patch gridstack with code like this:\n\n```js\n// extend gridstack with our own custom method\nGridStack.prototype.printCount = function() {\n  console.log('grid has ' + this.engine.nodes.length + ' items');\n};\n\nlet grid = GridStack.init();\n\n// you can now call\ngrid.printCount();\n```\n\n## Extend Engine\n\nYou can now (5.1+) easily create your own layout engine to further customize your usage. Here is a typescript example\n\n```ts\nimport { GridStack, GridStackEngine, GridStackNode, GridStackMoveOpts } from 'gridstack';\n\nclass CustomEngine extends GridStackEngine {\n\n  /** refined this to move the node to the given new location */\n  public override moveNode(node: GridStackNode, o: GridStackMoveOpts): boolean {\n    // keep the same original X and Width and let base do it all...\n    o.x = node.x;\n    o.w = node.w;\n    return super.moveNode(node, o);\n  }\n}\n\nGridStack.registerEngine(CustomEngine); // globally set our custom class\n```\n\n## Change grid columns\n\nGridStack makes it very easy if you need [1-12] columns out of the box (default is 12), but you always need **2 things** if you need to customize this:\n\n1) Change the `column` grid option when creating a grid to your number N\n```js\nGridStack.init( {column: N} );\n```\n\nNOTE: step 2 is OLD and not needed with v12+ which uses CSS variables instead of classes\n\n2) also include `gridstack-extra.css` if **N < 12** (else custom CSS - see next). Without these, things will not render/work correctly.\n```html\n<link href=\"node_modules/gridstack/dist/gridstack.min.css\" rel=\"stylesheet\"/>\n<link href=\"node_modules/gridstack/dist/gridstack-extra.min.css\" rel=\"stylesheet\"/>\n\n<div class=\"grid-stack\">...</div>\n```\n\nNote: class `.grid-stack-N` will automatically be added and we include `gridstack-extra.min.css` which defines CSS for grids with custom [2-11] columns. Anything more and you'll need to generate the SASS/CSS yourself (see next).\n\nSee example: [2 grids demo](http://gridstack.github.io/gridstack.js/demo/two.html) with 6 columns\n\n## Custom columns CSS (OLD, not needed with v12+)\n\nNOTE: step is OLD and not needed with v12+ which uses CSS variables instead of classes\n\nIf you need > 12 columns or want to generate the CSS manually you will need to generate CSS rules for `.grid-stack-item[gs-w=\"X\"]` and `.grid-stack-item[gs-x=\"X\"]`.\n\nFor instance for 4-column grid you need CSS to be:\n\n```css\n.gs-4 > .grid-stack-item[gs-x=\"1\"]  { left: 25% }\n.gs-4 > .grid-stack-item[gs-x=\"2\"]  { left: 50% }\n.gs-4 > .grid-stack-item[gs-x=\"3\"]  { left: 75% }\n\n.gs-4 > .grid-stack-item { width: 25% }\n.gs-4 > .grid-stack-item[gs-w=\"2\"]  { width: 50% }\n.gs-4 > .grid-stack-item[gs-w=\"3\"]  { width: 75% }\n.gs-4 > .grid-stack-item[gs-w=\"4\"]  { width: 100% }\n```\n\nBetter yet, here is a SCSS code snippet, you can use sites like [sassmeister.com](https://www.sassmeister.com/) to generate the CSS for you instead:\n\n```scss\n$columns: 20;\n@function fixed($float) {\n  @return round($float * 1000) / 1000; // total 2+3 digits being %\n}\n.gs-#{$columns} > .grid-stack-item {\n\n  width: fixed(100% / $columns);\n\n  @for $i from 1 through $columns - 1 {\n    &[gs-x='#{$i}'] { left: fixed((100% / $columns) * $i); }\n    &[gs-w='#{$i+1}'] { width: fixed((100% / $columns) * ($i+1)); }\n  }\n}\n```\n\nyou can also use the SCSS [src/gridstack-extra.scss](https://github.com/gridstack/gridstack.js/tree/master/src/gridstack-extra.scss) included in NPM package and modify to add more columns.\n\nSample gulp command for 30 columns:\n```js\ngulp.src('node_modules/gridstack/dist/src/gridstack-extra.scss')\n        .pipe(replace('$start: 2 !default;','$start: 30;'))\n        .pipe(replace('$end: 11 !default;','$end: 30;'))\n        .pipe(sass({outputStyle: 'compressed'}))\n        .pipe(rename({extname: '.min.css'}))\n        .pipe(gulp.dest('dist/css'))\n```\n\n## Override resizable/draggable options\n\nYou can override default `resizable`/`draggable` options. For instance to enable other then bottom right resizing handle\nyou can init gridstack like:\n\n```js\nGridStack.init({\n  resizable: {\n    handles: 'e,se,s,sw,w'\n  }\n});\n```\n\n## Touch devices support\n\ngridstack v6+ now support mobile out of the box, with the addition of native touch event (along with mouse event) for drag&drop and resize.\nOlder versions (3.2+) required the jq version with added touch punch, but doesn't work well with nested grids.\n\nThis option is now the default:\n\n```js\nlet options = {\n  alwaysShowResizeHandle: 'mobile' // true if we're on mobile devices\n};\nGridStack.init(options);\n```\n\nSee [example](http://gridstack.github.io/gridstack.js/demo/mobile.html).\n\n# Migrating\n## Migrating to v0.6\n\nstarting in 0.6.x `change` event are no longer sent (for pretty much most nodes!) when an item is just added/deleted unless it also changes other nodes (was incorrect and causing inefficiencies). You may need to track `added|removed` [events](https://github.com/gridstack/gridstack.js/tree/master/doc#events) if you didn't and relied on the old broken behavior.\n\n## Migrating to v1\n\nv1.0.0 removed Jquery from the API and external dependencies, which will require some code changes. Here is a list of the changes:\n\n0. see previous step if not on v0.6 already\n\n1. your code only needs to `import GridStack from 'gridstack'` or include `gridstack.all.js` and `gristack.css` (don't include other JS) and is recommended you do that as internal dependencies will change over time. If you are jquery based, see [jquery app](#jquery-application) section.\n\n2. code change:\n\n**OLD** initializing code + adding a widget + adding an event:\n```js\n// initialization returned Jquery element, requiring second call to get GridStack var\nvar grid = $('.grid-stack').gridstack(opts?).data('gridstack');\n\n// returned Jquery element\ngrid.addWidget($('<div><div class=\"grid-stack-item-content\"> test </div></div>'), undefined, undefined, 2, undefined, true);\n\n// jquery event handler\n$('.grid-stack').on('added', function(e, items) {/* items contains info */});\n\n// grid access after init\nvar grid = $('.grid-stack').data('gridstack');\n```\n**NEW**\n```js\n// element identifier defaults to '.grid-stack', returns the grid\n// Note: for Typescript use window.GridStack.init() until next native 2.x TS version\nvar grid = GridStack.init(opts?, element?);\n\n// returns DOM element\ngrid.addWidget('<div><div class=\"grid-stack-item-content\"> test </div></div>', {width: 2});\n// Note: in 3.x it's ever simpler \n// grid.addWidget({w:2, content: 'test'})\n\n// event handler\ngrid.on('added', function(e, items) {/* items contains info */});\n\n// grid access after init\nvar grid = el.gridstack; // where el = document.querySelector('.grid-stack') or other ways...\n```\nOther rename changes\n\n```js\n`GridStackUI` --> `GridStack`\n`GridStackUI.GridStackEngine` --> `GridStack.Engine`\n`grid.container` (jquery grid wrapper) --> `grid.el` // (grid DOM element)\n`grid.grid` (GridStackEngine) --> `grid.engine`\n`grid.setColumn(N)` --> `grid.column(N)` and `grid.column()` // to get value, old API still supported though\n```\n\nRecommend looking at the [many samples](./demo) for more code examples.\n\n## Migrating to v2\n\nmake sure to read v1 migration first!\n\nv2 is a Typescript rewrite of 1.x, removing all jquery events, using classes and overall code cleanup to support ES6 modules. Your code might need to change from 1.x\n\n1. In general methods that used no args (getter) vs setter can't be used in TS when the arguments differ (set/get are also not function calls so API would have changed). Instead we decided to have <b>all set methods return</b> `GridStack` to they can be chain-able (ex: `grid.float(true).cellHeight(10).column(6)`). Also legacy methods that used to take many parameters will now take a single object (typically `GridStackOptions` or `GridStackWidget`).\n\n```js\n`addWidget(el, x, y, width, height)` --> `addWidget(el, {with: 2})`\n// Note: in 2.1.x you can now just do addWidget({with: 2, content: \"text\"})\n`float()` --> `getFloat()` // to get value\n`cellHeight()` --> `getCellHeight()` // to get value\n`verticalMargin` --> `margin` // grid options and API that applies to all 4 sides.\n`verticalMargin()` --> `getMargin()` // to get value\n```\n\n2. event signatures are generic and not jquery-ui dependent anymore. `gsresizestop` has been removed as `resizestop|dragstop` are now called **after** the DOM attributes have been updated.\n\n3. `oneColumnMode` would trigger when `window.width` < 768px by default. We now check for grid width instead (more correct and supports nesting). You might need to adjust grid `oneColumnSize` or `disableOneColumnMode`.\n\n**Note:** 2.x no longer support legacy IE11 and older due to using more compact ES6 output and typecsript native code. You will need to stay at 1.x\n\n## Migrating to v3\n\nmake sure to read v2 migration first!\n\nv3 has a new HTML5 drag&drop plugging (63k total, all native code), while still allowing you to use the legacy jquery-ui version instead (188k), or a new static grid version (34k, no user drag&drop but full API support). You will need to decide which version to use as `gridstack.all.js` no longer exist (same is now `gridstack-jq.js`) - see [include info](#include).\n\n**NOTE**: HTML5 version is almost on parity with the old jquery-ui based drag&drop. the `containment` (prevent a child from being dragged outside it's parent) and `revert` (not clear what it is for yet) are not yet implemented in initial release of v3.0.0.<br>\nAlso mobile devices don't support h5 `drag` events (will need to handle `touch`) whereas v3.2 jq version now now supports out of the box (see [v3.2 release](https://github.com/gridstack/gridstack.js/releases/tag/v3.2.0))\n\nBreaking changes:\n\n1. include (as mentioned) need to change\n\n2. `GridStack.update(el, opt)` now takes single `GridStackWidget` options instead of only supporting (x,y,w,h) BUT legacy call in JS will continue working the same for now. That method is a complete re-write and does the right constrain and updates now for all the available params.\n\n3. `locked()`, `move()`, `resize()`, `minWidth()`, `minHeight()`, `maxWidth()`, `maxHeight()` methods are hidden from Typescript (JS can still call for now) as they are just 1 liner wrapper around `update(el, opt)` anyway and will go away soon. (ex: `move(el, x, y)` => `update(el, {x, y})`)\n\n4. item attribute like `data-gs-min-width` is now `gs-min-w`. We removed 'data-' from all attributes, and shorten 'width|height' to just 'w|h' to require less typing and more efficient (2k saved in .js alone!).\n\n5. `GridStackWidget` used in most API `width|height|minWidth|minHeight|maxWidth|maxHeight` are now shorter `w|h|minW|minH|maxW|maxH` as well\n\n## Migrating to v4\n\nmake sure to read v3 migration first!\n\nv4 is a complete re-write of the collision and drag in/out heuristics to fix some very long standing request & bugs. It also greatly improved usability. Read the release notes for more detail.\n\n**Unlikely** Breaking Changes (internal usage):\n\n1. `removeTimeout` was removed (feedback over trash will be immediate - actual removal still on mouse up)\n\n2. the following `GridStackEngine` methods changed (used internally, doesn't affect `GridStack` public API)\n\n```js\n// moved to 3 methods with new option params to support new code and pixel coverage check\n`collision()` -> `collide(), collideAll(), collideCoverage()`\n`moveNodeCheck(node, x, y, w, h)` -> `moveNodeCheck(node, opt: GridStackMoveOpts)`\n`isNodeChangedPosition(node, x, y, w, h)` -> `changedPosConstrain(node, opt: GridStackMoveOpts)`\n`moveNode(node, x, y, w, h, noPack)` -> `moveNode(node, opt: GridStackMoveOpts)`\n```\n\n3. removed old obsolete (v0.6-v1 methods/attrs) `getGridHeight()`, `verticalMargin`, `data-gs-current-height`,\n`locked()`, `maxWidth()`, `minWidth()`, `maxHeight()`, `minHeight()`, `move()`, `resize()`\n\n\n## Migrating to v5\n\nmake sure to read v4 migration first!\n\nv5 does not have any breaking changes from v4, but a focus on nested grids in h5 mode:\nYou can now drag in/out of parent into nested child, with new API parameters values. See the release notes.\n\n## Migrating to v6\n\nthe API did not really change from v5, but a complete re-write of Drag&Drop to use native `mouseevent` (instead of HTML draggable=true which is buggy on Mac Safari, and doesn't work on mobile devices) and `touchevent` (mobile), and we no longer have jquery ui option (wasn't working well for nested grids, didn't want to maintain legacy lib).\n\nThe main difference is you only need to include gridstack.js and get D&D (desktop and mobile) out of the box for the same size as h5 version.\n\n## Migrating to v7\n\nNew addition, no API breakage per say. See release notes about creating sub-grids on the fly.\n\n## Migrating to v8\n\nPossible breaking change if you use nested grid JSON format, or original Angular wrapper, or relied on specific CSS paths. Also target is now ES2020 (see release notes).\n* `GridStackOptions.subGrid` -> `GridStackOptions.subGridOpts` rename. We now have `GridStackWidget.subGridOpts` vs `GridStackNode.subGrid` (was both types which is error prone)\n* `GridStackOptions.addRemoveCB` -> `GridStack.addRemoveCB` is now global instead of grid option\n* removed `GridStackOptions.dragInOptions` since `GridStack.setupDragIn()` has it replaced since 4.0\n* remove `GridStackOptions.minWidth` obsolete since 5.1, use `oneColumnSize` instead\n* CSS rules removed `.grid-stack` prefix for anything already gs based, 12 column (default) now uses `.gs-12`, extra.css is less than 1/4th it original size!, `gs-min|max_w|h` attribute no longer written (but read)\n\n## Migrating to v9\n\nNew addition - see release notes about `sizeToContent` feature.\nPossible break:\n* `GridStack.onParentResize()` is now called `onResize()` as grid now directly track size change, no longer involving parent per say to tell us anything. Note sure why it was public.\n\n## Migrating to v10\n\nwe now support much richer responsive behavior with `GridStackOptions.columnOpts` including any breakpoint width:column pairs, or automatic column sizing.\n\nbreaking change: \n* `disableOneColumnMode`, `oneColumnSize` have been removed (thought we temporary convert if you have them). use `columnOpts: { breakpoints: [{w:768, c:1}] }` for the same behavior.\n* 1 column mode switch is no longer by default (`columnOpts` is not defined) as too many new users had issues. Instead set it explicitly (see above).\n* `oneColumnModeDomSort` has been removed. Planning to support per column layouts at some future times. TBD\n\n## Migrating to v11\n\n* All instances of `el.innerHTML = 'some content'` have been removed for security reason as it opens up some potential for accidental XSS.\n\n* Side panel drag&drop complete rewrite.\n\n* new lazy loading option\n\n**Breaking change:**\n\n* V11 add new `GridStack.renderCB` that is called for you to create the widget content (entire GridStackWidget is passed so you can use id or some other field as logic) while GS creates the 2 needed parent divs + classes, unlike `GridStack.addRemoveCB` which doesn't create anything for you. Both can be handy for Angular/React/Vue frameworks.\n* `addWidget(w: GridStackWidget)` is now the only supported format, no more string content passing. You will need to create content yourself as shown below, OR use `GridStack.createWidgetDivs()` to create parent divs, do the innerHtml, then call `makeWidget(el)` instead.\n* if your code relies on `GridStackWidget.content` with real HTML (like a few demos) it is up to you to do this:\n```ts\n// NOTE: REAL apps would sanitize-html or DOMPurify before blinding setting innerHTML. see #2736\nGridStack.renderCB = function(el: HTMLElement, w: GridStackNode) {\n  el.innerHTML = w.content;\n};\n\n// now you can create widgets like this again\nlet gridWidget = grid.addWidget({x, y, w, h, content: '<div>My html content</div>'});\n```\n\n**Potential breaking change:**\n\n* BIG overall to how sidepanel helper drag&drop is done:\n1. `clone()` helper is now passed full HTML element dragged, not an event on `grid-stack-item-content` so you can clone or set attr at the top.\n2. use any class/structure you want for side panel items (see two.html)\n3. `GridStack.setupDragIn()` now support associating a `GridStackWidget` for each sidepanel that will be used to define what to create on drop!\n4. if no `GridStackWidget` is defined, the helper will now be inserted as is, and NOT original sidepanel item.\n5. support DOM gs- attr as well as gridstacknode JSON (see two.html) alternatives.\n\n## Migrating to v12\n\n* column and cell height code has been re-writen to use browser CSS variables, and we no longer need a tons of custom CSS classes!\nthis fixes a long standing issue where people forget to include the right CSS for non 12 columns layouts, and a big speedup in many cases (many columns, or small cellHeight values).\n\n**Potential breaking change:**\n* `gridstack-extra.min.css` no longer exist, nor is custom column CSS classes needed. API/options hasn't changed.\n* (v12.1) `ES5` folder content has been removed - was for IE support, which has been dropped.\n* (v12.1) nested grid events are now sent to the main grid. You might have to adjust your workaround of this missing feature. nested.html demo has been adjusted.\n\n# jQuery Application\n\nThis is **old and no longer apply to v6+**. You'll need to use v5.1.1 and before\n\n```js\nimport 'gridstack/dist/gridstack.min.css';\nimport { GridStack } from 'gridstack';\nimport 'gridstack/dist/jq/gridstack-dd-jqueryui';\n```\n**Note**: `jquery` & `jquery-ui` are imported by name, so you will have to specify their location in your webpack (or equivalent) config file, \nwhich means you can possibly bring your own version\n```js\n  alias: {\n    'jquery': 'gridstack/dist/jq/jquery.js',\n    'jquery-ui': 'gridstack/dist/jq/jquery-ui.js',\n    'jquery.ui': 'gridstack/dist/jq/jquery-ui.js',\n    'jquery.ui.touch-punch': 'gridstack/dist/jq/jquery.ui.touch-punch.js',\n  },\n```\nAlternatively (single combined file) in html\n\n```html\n<link href=\"node_modules/gridstack/dist/gridstack.min.css\" rel=\"stylesheet\"/>\n<!-- HTML5 drag&drop (70k) -->\n<script src=\"node_modules/gridstack/dist/gridstack-h5.js\"></script>\n<!-- OR jquery-ui drag&drop (195k) -->\n<script src=\"node_modules/gridstack/dist/gridstack-jq.js\"></script>\n<!-- OR static grid (40k) -->\n<script src=\"node_modules/gridstack/dist/gridstack-static.js\"></script>\n```\n\nWe have a native HTML5 drag'n'drop through the plugin system (default), but the jquery-ui version can be used instead. It will bundle `jquery` (3.5.1) + `jquery-ui` (1.13.1 minimal drag|drop|resize) + `jquery-ui-touch-punch` (1.0.8 for mobile support) in `gridstack-jq.js`. \n\n**NOTE: in v4, v3**: we ES6 module import jquery & jquery-ui by name, so you need to specify location of those .js files, which means you might be able to bring your own version as well. See the include instructions.\n\n**NOTE: in v1.x** IFF you want to use gridstack-jq instead and your app needs to bring your own JQ version, you should **instead** include `gridstack-poly.min.js` (optional IE support) + `gridstack.min.js` + `gridstack.jQueryUI.min.js` after you import your JQ libs. But note that there are issue with jQuery and ES6 import (see [1306](https://github.com/gridstack/gridstack.js/issues/1306)).\n\nAs for events, you can still use `$(\".grid-stack\").on(...)` for the version that uses jquery-ui for things we don't support.\n\n# Changes\n\nView our change log [here](https://github.com/gridstack/gridstack.js/tree/master/doc/CHANGES.md).\n\n# Usage Trend\n\n[Usage Trend of gridstack](https://npm-compare.com/gridstack#timeRange=THREE_YEARS)\n  \n<a href=\"https://npm-compare.com/gridstack#timeRange=THREE_YEARS\" target=\"_blank\">\n  <img src=\"https://npm-compare.com/img/npm-trend/THREE_YEARS/gridstack.png\" width=\"70%\" alt=\"NPM Usage Trend of gridstack\" />\n</a>\n\n# The Team\n\ngridstack.js is currently maintained by [Alain Dumesny](https://github.com/adumesny), before that [Dylan Weiss](https://github.com/radiolips), originally created by [Pavel Reznikov](https://github.com/troolee). We appreciate [all contributors](https://github.com/gridstack/gridstack.js/graphs/contributors) for help.\n"
  },
  {
    "path": "TESTING.md",
    "content": "# Testing Guide\n\nThis project uses **Vitest** as the modern testing framework, replacing the previous Karma + Jasmine setup. Vitest provides faster test execution, better TypeScript support, and enhanced developer experience.\n\n## Quick Start\n\n```bash\n# Install dependencies\nyarn install\n\n# Run all tests once\nyarn test\n\n# Run tests in watch mode (development)\nyarn test:watch\n\n# Run tests with coverage\nyarn test:coverage\n\n# Open coverage report in browser  \nyarn test:coverage:html\n\n# Run tests with UI interface\nyarn test:ui\n```\n\n## Testing Framework\n\n### Vitest Features\n- ⚡ **Fast**: Native ESM support and Vite's dev server\n- 🔧 **Zero Config**: Works out of the box with TypeScript\n- 🎯 **Jest Compatible**: Same API as Jest for easy migration\n- 📊 **Built-in Coverage**: V8 coverage with multiple reporters\n- 🎨 **UI Interface**: Optional web UI for test debugging\n- 🔍 **Watch Mode**: Smart re-running of affected tests\n\n### Key Changes from Karma/Jasmine\n- `function() {}` → `() => {}` (arrow functions)\n- `jasmine.objectContaining()` → `expect.objectContaining()`\n- `toThrowError()` → `toThrow()`\n- Global `describe`, `it`, `expect` without imports\n\n## Test Scripts\n\n| Command | Description |\n|---------|-------------|\n| `yarn test` | Run tests once with linting |\n| `yarn test:watch` | Run tests in watch mode |\n| `yarn test:ui` | Open Vitest UI in browser |\n| `yarn test:coverage` | Run tests with coverage report |\n| `yarn test:coverage:ui` | Coverage with UI interface |\n| `yarn test:coverage:detailed` | Detailed coverage with thresholds |\n| `yarn test:coverage:html` | Generate and open HTML coverage |\n| `yarn test:coverage:lcov` | Generate LCOV format for CI |\n| `yarn test:ci` | CI-optimized run with JUnit output |\n\n## Coverage Reports\n\n### Coverage Thresholds\n- **Global**: 85% minimum for branches, functions, lines, statements\n- **Core Files**: 90% minimum for `gridstack.ts` and `gridstack-engine.ts`\n- **Utils**: 85% minimum for `utils.ts`\n\n### Coverage Formats\n- **HTML**: Interactive browser report at `coverage/index.html`\n- **LCOV**: For integration with CI tools and code coverage services\n- **JSON**: Machine-readable format for automated processing\n- **Text**: Terminal summary output\n- **JUnit**: XML format for CI/CD pipelines\n\n### Viewing Coverage\n```bash\n# Generate and view HTML coverage report\nyarn test:coverage:html\n\n# View coverage in terminal\nyarn test:coverage\n\n# Generate LCOV for external tools\nyarn test:coverage:lcov\n```\n\n## Configuration Files\n\n- **`vitest.config.ts`**: Main Vitest configuration\n- **`vitest.setup.ts`**: Test environment setup and global mocks\n- **`.vitestrc.coverage.ts`**: Enhanced coverage configuration\n- **`tsconfig.json`**: TypeScript configuration with Vitest types\n\n## Writing Tests\n\n### Basic Test Structure\n```typescript\nimport { Utils } from '../src/utils';\n\ndescribe('Utils', () => {\n  it('should parse boolean values correctly', () => {\n    expect(Utils.toBool(true)).toBe(true);\n    expect(Utils.toBool(false)).toBe(false);\n    expect(Utils.toBool(1)).toBe(true);\n    expect(Utils.toBool(0)).toBe(false);\n  });\n});\n```\n\n### DOM Testing\n```typescript\ndescribe('GridStack DOM', () => {\n  beforeEach(() => {\n    document.body.innerHTML = '<div class=\"grid-stack\"></div>';\n  });\n\n  it('should create grid element', () => {\n    const grid = document.querySelector('.grid-stack');\n    expect(grid).toBeInTheDocument();\n  });\n});\n```\n\n### Mocking\n```typescript\n// Mock a module\nvi.mock('../src/utils', () => ({\n  Utils: {\n    toBool: vi.fn()\n  }\n}));\n\n// Mock DOM APIs\nObject.defineProperty(window, 'ResizeObserver', {\n  value: vi.fn().mockImplementation(() => ({\n    observe: vi.fn(),\n    unobserve: vi.fn(),\n    disconnect: vi.fn()\n  }))\n});\n```\n\n## File Organization\n\n```\nspec/\n├── utils-spec.ts           # Utils module tests\n├── gridstack-spec.ts       # Main GridStack tests  \n├── gridstack-engine-spec.ts # Engine logic tests\n├── regression-spec.ts      # Regression tests\n└── e2e/                   # End-to-end tests (not in coverage)\n```\n\n## CI/CD Integration\n\n### GitHub Actions Example\n```yaml\n- name: Run Tests\n  run: yarn test:ci\n\n- name: Upload Coverage\n  uses: codecov/codecov-action@v3\n  with:\n    file: ./coverage/lcov.info\n```\n\n### Test Results\n- **JUnit XML**: `coverage/junit-report.xml`\n- **Coverage LCOV**: `coverage/lcov.info`\n- **Coverage JSON**: `coverage/coverage-final.json`\n\n## Debugging Tests\n\n### VS Code Integration\n1. Install \"Vitest\" extension\n2. Run tests directly from editor\n3. Set breakpoints and debug\n\n### Browser UI\n```bash\nyarn test:ui\n```\nOpens a web interface for:\n- Running individual tests\n- Viewing test results\n- Coverage visualization\n- Real-time updates\n\n## Performance\n\n### Speed Comparison\n- **Karma + Jasmine**: ~15-20 seconds\n- **Vitest**: ~3-5 seconds\n- **Watch Mode**: Sub-second re-runs\n\n### Optimization Tips\n- Use `vi.mock()` for heavy dependencies\n- Prefer `toBe()` over `toEqual()` for primitives\n- Group related tests in `describe` blocks\n- Use `beforeEach`/`afterEach` for setup/cleanup\n\n## Migration Notes\n\nThis project was migrated from Karma + Jasmine to Vitest with the following changes:\n\n1. **Dependencies**: Removed karma-\\* packages, added vitest + utilities\n2. **Configuration**: Replaced `karma.conf.js` with `vitest.config.ts`\n3. **Syntax**: Updated test syntax to modern ES6+ style\n4. **Coverage**: Enhanced coverage with V8 provider and multiple formats\n5. **Scripts**: New npm scripts for various testing workflows\n\nAll existing tests were preserved and converted to work with Vitest.\n"
  },
  {
    "path": "angular/.editorconfig",
    "content": "# Editor configuration, see https://editorconfig.org\nroot = true\n\n[*]\ncharset = utf-8\nindent_style = space\nindent_size = 2\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n\n[*.ts]\nquote_type = single\n\n[*.md]\nmax_line_length = off\ntrim_trailing_whitespace = false\n"
  },
  {
    "path": "angular/.gitignore",
    "content": "# See http://help.github.com/ignore-files/ for more about ignoring files.\n\n# Compiled output\n/dist\n/tmp\n/out-tsc\n/bazel-out\n/doc/html/\n\n# Node\n/node_modules\nnpm-debug.log\nyarn-error.log\n\n# IDEs and editors\n.idea/\n.project\n.classpath\n.c9/\n*.launch\n.settings/\n*.sublime-workspace\n\n# Visual Studio Code\n.vscode/*\n!.vscode/settings.json\n!.vscode/tasks.json\n!.vscode/launch.json\n!.vscode/extensions.json\n.history/*\n\n# Miscellaneous\n/.angular/cache\n.sass-cache/\n/connect.lock\n/coverage\n/libpeerconnection.log\ntestem.log\n/typings\n\n# System files\n.DS_Store\nThumbs.db\n"
  },
  {
    "path": "angular/README.md",
    "content": "# Angular wrapper\n\nThe Angular [wrapper component](projects/lib/src/lib/gridstack.component.ts) <gridstack> is a <b>better way to use Gridstack</b>, but alternative raw [ngFor](projects/demo/src/app/ngFor.ts) or [simple](projects/demo/src/app/simple.ts) demos are also given.\n\nRunning version can be seen here https://stackblitz.com/edit/gridstack-angular\n\n# Dynamic grid items\n\nthis is the recommended way if you are going to have multiple grids (alow drag&drop between) or drag from toolbar to create items, or drag to remove items, etc...\n\nI.E. don't use Angular templating to create grid items as that is harder to sync when gridstack will also add/remove items.\n\nMyComponent HTML\n\n```html\n<gridstack [options]=\"gridOptions\"></gridstack>\n```\n\nMyComponent CSS\n\n```css\n@import \"gridstack/dist/gridstack.min.css\";\n\n.grid-stack {\n  background: #fafad2;\n}\n.grid-stack-item-content {\n  text-align: center;\n  background-color: #18bc9c;\n}\n```\n\n\nStandalone MyComponent Code\n\n```ts\nimport { GridStackOptions } from 'gridstack';\nimport { GridstackComponent, GridstackItemComponent } from 'gridstack/dist/angular';\n\n@Component({\n  imports: [ // SKIP if doing module import instead (next)\n    GridstackComponent,\n    GridstackItemComponent\n  ]\n  ...\n })\nexport class MyComponent {\n  // sample grid options + items to load...\n  public gridOptions: GridStackOptions = {\n    margin: 5,\n    children: [ // or call load(children) or addWidget(children[0]) with same data\n      {x:0, y:0, minW:2, content:'Item 1'},\n      {x:1, y:0, content:'Item 2'},\n      {x:0, y:1, content:'Item 3'},\n    ]\n  }\n\n}\n```\n\nIF doing module import instead of standalone, you will also need this:\n\n```ts\nimport { GridstackModule } from 'gridstack/dist/angular';\n\n@NgModule({\n  imports: [GridstackModule, ...]\n  ...\n  bootstrap: [AppComponent]\n})\nexport class AppModule { }\n```\n\n# More Complete example\n\nIn this example (build on previous one) will use your actual custom angular components inside each grid item (instead of dummy html content) and have per component saved settings as well (using BaseWidget).\n\nHTML\n\n```html\n<gridstack [options]=\"gridOptions\" (changeCB)=\"onChange($event)\">\n  <div empty-content>message when grid is empty</div>\n</gridstack>\n```\n\nCode\n\n```ts\nimport { Component } from '@angular/core';\nimport { GridStack, GridStackOptions } from 'gridstack';\nimport { GridstackComponent, gsCreateNgComponents, NgGridStackWidget, nodesCB, BaseWidget } from 'gridstack/dist/angular';\n\n// some custom components\n@Component({\n  selector: 'app-a',\n  template: 'Comp A {{text}}',\n})\nexport class AComponent extends BaseWidget implements OnDestroy {\n  @Input() text: string = 'foo'; // test custom input data\n  public override serialize(): NgCompInputs | undefined  { return this.text ? {text: this.text} : undefined; }\n  ngOnDestroy() {\n    console.log('Comp A destroyed'); // test to make sure cleanup happens\n  }\n}\n\n@Component({\n  selector: 'app-b',\n  template: 'Comp B',\n})\nexport class BComponent extends BaseWidget {\n}\n\n// ...in your module (classic), OR your ng19 app.config provideEnvironmentInitializer call this:\nconstructor() {\n  // register all our dynamic components types created by the grid\n  GridstackComponent.addComponentToSelectorType([AComponent, BComponent]) ;\n}\n\n// now our content will use Components instead of dummy html content\npublic gridOptions: NgGridStackOptions = {\n  margin: 5,\n  minRow: 1, // make space for empty message\n  children: [ // or call load()/addWidget() with same data\n    {x:0, y:0, minW:2, selector:'app-a'},\n    {x:1, y:0, minW:2, selector:'app-a', input: { text: 'bar' }}, // custom input that works using BaseWidget.deserialize() Object.assign(this, w.input)\n    {x:2, y:0, selector:'app-b'},\n    {x:3, y:0, content:'plain html'},\n  ]\n}\n\n// called whenever items change size/position/etc.. see other events\npublic onChange(data: nodesCB) {\n  console.log('change ', data.nodes.length > 1 ? data.nodes : data.nodes[0]);\n}\n```\n\n# ngFor with wrapper\n\nFor simple case where you control the children creation (gridstack doesn't do create or re-parenting)\n\nHTML\n\n```html\n<gridstack [options]=\"gridOptions\" (changeCB)=\"onChange($event)\">\n  <!-- Angular 17+ -->\n   @for (n of items; track n.id) {\n    <gridstack-item [options]=\"n\">Item {{n.id}}</gridstack-item>\n  }\n  <!-- Angular 16 -->\n  <gridstack-item *ngFor=\"let n of items; trackBy: identify\" [options]=\"n\"> Item {{n.id}} </gridstack-item>\n</gridstack>\n```\n\nCode\n\n```javascript\nimport { GridStackOptions, GridStackWidget } from 'gridstack';\nimport { nodesCB } from 'gridstack/dist/angular';\n\n/** sample grid options and items to load... */\npublic gridOptions: GridStackOptions = { margin: 5 }\npublic items: GridStackWidget[] = [\n  {x:0, y:0, minW:2, id:'1'}, // must have unique id used for trackBy\n  {x:1, y:0, id:'2'},\n  {x:0, y:1, id:'3'},\n];\n\n// called whenever items change size/position/etc..\npublic onChange(data: nodesCB) {\n  console.log('change ', data.nodes.length > 1 ? data.nodes : data.nodes[0]);\n}\n\n// ngFor unique node id to have correct match between our items used and GS\npublic identify(index: number, w: GridStackWidget) {\n  return w.id; // or use index if no id is set and you only modify at the end...\n}\n```\n\n## Demo\n\nYou can see a fuller example at [app.component.ts](projects/demo/src/app/app.component.ts)\n\nto build the demo, go to [angular/projects/demo](projects/demo/) and run `yarn` + `yarn start` and navigate to `http://localhost:4200/`\n\nCode started shipping with v8.1.2+ in `dist/angular` for people to use directly and is an angular module! (source code under `dist/angular/src`)\n\n## Caveats\n\n- This wrapper needs:\n  - gridstack v8+ to run as it needs the latest changes (use older version that matches GS versions)\n  - <b>Angular 14+</b> for dynamic `createComponent()` API and Standalone Components (verified against 19+)\n\nNOTE: if you are on Angular 13 or below: copy the wrapper code over (or patch it - see main page example) and change `createComponent()` calls to use old API instead:\nNOTE2: now that we're using standalone, you will also need to remove `standalone: true` and `imports` on each component so you will to copy those locally (or use <11.1.2 version)\n```ts\nprotected resolver: ComponentFactoryResolver,\n...\nconst factory = this.resolver.resolveComponentFactory(GridItemComponent);\nconst gridItemRef = grid.container.createComponent(factory) as ComponentRef<GridItemComponent>;\n// ...do the same for widget selector...\n```\n\n## ngFor Caveats\n\n- This wrapper handles well ngFor loops, but if you're using a trackBy function (as I would recommend) and no element id change after an update,\n  you must manually update the `GridstackItemComponent.option` directly - see [modifyNgFor()](./projects/demo/src/app/app.component.ts#L202) example.\n- The original client list of items is not updated to match **content** changes made by gridstack (TBD later), but adding new item or removing (as shown in demo) will update those new items. Client could use change/added/removed events to sync that list if they wish to do so.\n\nWould appreciate getting help doing the same for React and Vue (2 other popular frameworks)\n\n-Alain\n"
  },
  {
    "path": "angular/README_build.md",
    "content": "# GridstackLib\n\nThis project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.2.10.\n\n## Development server\n\nRun `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.\n\n## Code scaffolding\n\nRun `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.\n\n## Build\n\nRun `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.\n\n## Running unit tests\n\nRun `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).\n\n## Running end-to-end tests\n\nRun `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.\n\n## Further help\n\nTo get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.\n"
  },
  {
    "path": "angular/angular.json",
    "content": "{\n  \"$schema\": \"./node_modules/@angular/cli/lib/config/schema.json\",\n  \"version\": 1,\n  \"newProjectRoot\": \"projects\",\n  \"projects\": {\n    \"lib\": {\n      \"projectType\": \"library\",\n      \"root\": \"projects/lib\",\n      \"sourceRoot\": \"projects/lib/src\",\n      \"prefix\": \"lib\",\n      \"architect\": {\n        \"build\": {\n          \"builder\": \"@angular-devkit/build-angular:ng-packagr\",\n          \"options\": {\n            \"project\": \"projects/lib/ng-package.json\"\n          },\n          \"configurations\": {\n            \"production\": {\n              \"tsConfig\": \"projects/lib/tsconfig.lib.prod.json\"\n            },\n            \"development\": {\n              \"tsConfig\": \"projects/lib/tsconfig.lib.json\"\n            }\n          },\n          \"defaultConfiguration\": \"production\"\n        },\n        \"test\": {\n          \"builder\": \"@angular-devkit/build-angular:karma\",\n          \"options\": {\n            \"main\": \"projects/lib/src/test.ts\",\n            \"tsConfig\": \"projects/lib/tsconfig.spec.json\",\n            \"karmaConfig\": \"projects/lib/karma.conf.js\"\n          }\n        }\n      }\n    },\n    \"demo\": {\n      \"projectType\": \"application\",\n      \"schematics\": {},\n      \"root\": \"projects/demo\",\n      \"sourceRoot\": \"projects/demo/src\",\n      \"prefix\": \"app\",\n      \"architect\": {\n        \"build\": {\n          \"builder\": \"@angular-devkit/build-angular:browser\",\n          \"options\": {\n            \"outputPath\": \"dist/demo\",\n            \"index\": \"projects/demo/src/index.html\",\n            \"main\": \"projects/demo/src/main.ts\",\n            \"polyfills\": \"projects/demo/src/polyfills.ts\",\n            \"tsConfig\": \"projects/demo/tsconfig.app.json\",\n            \"assets\": [\n              \"projects/demo/src/favicon.ico\",\n              \"projects/demo/src/assets\"\n            ],\n            \"styles\": [\n              \"node_modules/gridstack/dist/gridstack.min.css\",\n              \"projects/demo/src/styles.css\"\n            ],\n            \"scripts\": []\n          },\n          \"configurations\": {\n            \"production\": {\n              \"budgets\": [{\n                  \"type\": \"initial\",\n                  \"maximumWarning\": \"500kb\",\n                  \"maximumError\": \"1mb\"\n                },\n                {\n                  \"type\": \"anyComponentStyle\",\n                  \"maximumWarning\": \"2kb\",\n                  \"maximumError\": \"4kb\"\n                }\n              ],\n              \"fileReplacements\": [{\n                \"replace\": \"projects/demo/src/environments/environment.ts\",\n                \"with\": \"projects/demo/src/environments/environment.prod.ts\"\n              }],\n              \"outputHashing\": \"all\"\n            },\n            \"development\": {\n              \"buildOptimizer\": false,\n              \"optimization\": false,\n              \"vendorChunk\": true,\n              \"extractLicenses\": false,\n              \"sourceMap\": true,\n              \"namedChunks\": true\n            }\n          },\n          \"defaultConfiguration\": \"production\"\n        },\n        \"serve\": {\n          \"builder\": \"@angular-devkit/build-angular:dev-server\",\n          \"configurations\": {\n            \"production\": {\n              \"browserTarget\": \"demo:build:production\"\n            },\n            \"development\": {\n              \"browserTarget\": \"demo:build:development\"\n            }\n          },\n          \"defaultConfiguration\": \"development\"\n        },\n        \"extract-i18n\": {\n          \"builder\": \"@angular-devkit/build-angular:extract-i18n\",\n          \"options\": {\n            \"browserTarget\": \"demo:build\"\n          }\n        },\n        \"test\": {\n          \"builder\": \"@angular-devkit/build-angular:karma\",\n          \"options\": {\n            \"main\": \"projects/demo/src/test.ts\",\n            \"polyfills\": \"projects/demo/src/polyfills.ts\",\n            \"tsConfig\": \"projects/demo/tsconfig.spec.json\",\n            \"karmaConfig\": \"projects/demo/karma.conf.js\",\n            \"assets\": [\n              \"projects/demo/src/favicon.ico\",\n              \"projects/demo/src/assets\"\n            ],\n            \"styles\": [\n              \"node_modules/gridstack/dist/gridstack.min.css\",\n              \"projects/demo/src/styles.css\"\n            ],\n            \"scripts\": []\n          }\n        }\n      }\n    }\n  },\n  \"cli\": {\n    \"analytics\": false\n  }\n}\n"
  },
  {
    "path": "angular/doc/api/base-widget.md",
    "content": "# base-widget\n\n## Classes\n\n### `abstract` BaseWidget\n\nDefined in: [angular/projects/lib/src/lib/base-widget.ts:39](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/base-widget.ts#L39)\n\nBase widget class for GridStack Angular integration.\n\n#### Constructors\n\n##### Constructor\n\n```ts\nnew BaseWidget(): BaseWidget;\n```\n\n###### Returns\n\n[`BaseWidget`](#basewidget)\n\n#### Methods\n\n##### serialize()\n\n```ts\nserialize(): undefined | NgCompInputs;\n```\n\nDefined in: [angular/projects/lib/src/lib/base-widget.ts:66](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/base-widget.ts#L66)\n\nOverride this method to return serializable data for this widget.\n\nReturn an object with properties that map to your component's @Input() fields.\r\nThe selector is handled automatically, so only include component-specific data.\n\n###### Returns\n\n`undefined` \\| [`NgCompInputs`](types.md#ngcompinputs)\n\nObject containing serializable component data\n\n###### Example\n\n```typescript\r\nserialize() {\r\n  return {\r\n    title: this.title,\r\n    value: this.value,\r\n    settings: this.settings\r\n  };\r\n}\r\n```\n\n##### deserialize()\n\n```ts\ndeserialize(w): void;\n```\n\nDefined in: [angular/projects/lib/src/lib/base-widget.ts:88](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/base-widget.ts#L88)\n\nOverride this method to handle widget restoration from saved data.\n\nUse this for complex initialization that goes beyond simple @Input() mapping.\r\nThe default implementation automatically assigns input data to component properties.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `w` | [`NgGridStackWidget`](types.md#nggridstackwidget) | The saved widget data including input properties |\n\n###### Returns\n\n`void`\n\n###### Example\n\n```typescript\r\ndeserialize(w: NgGridStackWidget) {\r\n  super.deserialize(w); // Call parent for basic setup\n\n  // Custom initialization logic\r\n  if (w.input?.complexData) {\r\n    this.processComplexData(w.input.complexData);\r\n  }\r\n}\r\n```\n\n#### Properties\n\n| Property | Modifier | Type | Description | Defined in |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"widgetitem\"></a> `widgetItem?` | `public` | [`NgGridStackWidget`](types.md#nggridstackwidget) | Complete widget definition including position, size, and Angular-specific data. Populated automatically when the widget is loaded or saved. | [angular/projects/lib/src/lib/base-widget.ts:45](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/base-widget.ts#L45) |\n"
  },
  {
    "path": "angular/doc/api/gridstack-item.component.md",
    "content": "# gridstack-item.component\n\n## Classes\n\n### GridstackItemComponent\n\nDefined in: [angular/projects/lib/src/lib/gridstack-item.component.ts:56](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack-item.component.ts#L56)\n\nAngular component wrapper for individual GridStack items.\n\nThis component represents a single grid item and handles:\n- Dynamic content creation and management\n- Integration with parent GridStack component\n- Component lifecycle and cleanup\n- Widget options and configuration\n\nUse in combination with GridstackComponent for the parent grid.\n\n#### Example\n\n```html\n<gridstack>\n  <gridstack-item [options]=\"{x: 0, y: 0, w: 2, h: 1}\">\n    <my-widget-component></my-widget-component>\n  </gridstack-item>\n</gridstack>\n```\n\n#### Implements\n\n- `OnDestroy`\n\n#### Accessors\n\n##### options\n\n###### Get Signature\n\n```ts\nget options(): GridStackNode;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack-item.component.ts:100](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack-item.component.ts#L100)\n\nreturn the latest grid options (from GS once built, otherwise initial values)\n\n###### Returns\n\n`GridStackNode`\n\n###### Set Signature\n\n```ts\nset options(val): void;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack-item.component.ts:89](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack-item.component.ts#L89)\n\nGrid item configuration options.\nDefines position, size, and behavior of this grid item.\n\n###### Example\n\n```typescript\nitemOptions: GridStackNode = {\n  x: 0, y: 0, w: 2, h: 1,\n  noResize: true,\n  content: 'Item content'\n};\n```\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `val` | `GridStackNode` |\n\n###### Returns\n\n`void`\n\n##### el\n\n###### Get Signature\n\n```ts\nget el(): GridItemCompHTMLElement;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack-item.component.ts:107](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack-item.component.ts#L107)\n\nreturn the native element that contains grid specific fields as well\n\n###### Returns\n\n[`GridItemCompHTMLElement`](#griditemcomphtmlelement)\n\n#### Constructors\n\n##### Constructor\n\n```ts\nnew GridstackItemComponent(elementRef): GridstackItemComponent;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack-item.component.ts:114](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack-item.component.ts#L114)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `elementRef` | `ElementRef`\\<[`GridItemCompHTMLElement`](#griditemcomphtmlelement)\\> |\n\n###### Returns\n\n[`GridstackItemComponent`](#gridstackitemcomponent)\n\n#### Methods\n\n##### clearOptions()\n\n```ts\nclearOptions(): void;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack-item.component.ts:110](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack-item.component.ts#L110)\n\nclears the initial options now that we've built\n\n###### Returns\n\n`void`\n\n##### ngOnDestroy()\n\n```ts\nngOnDestroy(): void;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack-item.component.ts:118](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack-item.component.ts#L118)\n\nA callback method that performs custom clean-up, invoked immediately\nbefore a directive, pipe, or service instance is destroyed.\n\n###### Returns\n\n`void`\n\n###### Implementation of\n\n```ts\nOnDestroy.ngOnDestroy\n```\n\n#### Properties\n\n| Property | Modifier | Type | Description | Defined in |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"container\"></a> `container?` | `public` | `ViewContainerRef` | Container for dynamic component creation within this grid item. Used to append child components programmatically. | [angular/projects/lib/src/lib/gridstack-item.component.ts:62](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack-item.component.ts#L62) |\n| <a id=\"ref\"></a> `ref` | `public` | \\| `undefined` \\| `ComponentRef`\\<[`GridstackItemComponent`](#gridstackitemcomponent)\\> | Component reference for dynamic component removal. Used internally when this component is created dynamically. | [angular/projects/lib/src/lib/gridstack-item.component.ts:68](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack-item.component.ts#L68) |\n| <a id=\"childwidget\"></a> `childWidget` | `public` | `undefined` \\| [`BaseWidget`](base-widget.md#basewidget) | Reference to child widget component for serialization. Used to save/restore additional data along with grid position. | [angular/projects/lib/src/lib/gridstack-item.component.ts:74](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack-item.component.ts#L74) |\n| <a id=\"_options\"></a> `_options?` | `protected` | `GridStackNode` | - | [angular/projects/lib/src/lib/gridstack-item.component.ts:104](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack-item.component.ts#L104) |\n| <a id=\"elementref\"></a> `elementRef` | `readonly` | `ElementRef`\\<[`GridItemCompHTMLElement`](#griditemcomphtmlelement)\\> | - | [angular/projects/lib/src/lib/gridstack-item.component.ts:114](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack-item.component.ts#L114) |\n\n## Interfaces\n\n### GridItemCompHTMLElement\n\nDefined in: [angular/projects/lib/src/lib/gridstack-item.component.ts:14](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack-item.component.ts#L14)\n\nExtended HTMLElement interface for grid items.\nStores a back-reference to the Angular component for integration.\n\n#### Extends\n\n- `GridItemHTMLElement`\n\n#### Methods\n\n##### animate()\n\n```ts\nanimate(keyframes, options?): Animation;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:2146\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `keyframes` | `null` \\| `Keyframe`[] \\| `PropertyIndexedKeyframes` |\n| `options?` | `number` \\| `KeyframeAnimationOptions` |\n\n###### Returns\n\n`Animation`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.animate\n```\n\n##### getAnimations()\n\n```ts\ngetAnimations(options?): Animation[];\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:2147\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `GetAnimationsOptions` |\n\n###### Returns\n\n`Animation`[]\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.getAnimations\n```\n\n##### after()\n\n```ts\nafter(...nodes): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:3747\n\nInserts nodes just after node, while replacing strings in nodes with equivalent Text nodes.\n\nThrows a \"HierarchyRequestError\" DOMException if the constraints of the node tree are violated.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| ...`nodes` | (`string` \\| `Node`)[] |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.after\n```\n\n##### before()\n\n```ts\nbefore(...nodes): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:3753\n\nInserts nodes just before node, while replacing strings in nodes with equivalent Text nodes.\n\nThrows a \"HierarchyRequestError\" DOMException if the constraints of the node tree are violated.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| ...`nodes` | (`string` \\| `Node`)[] |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.before\n```\n\n##### remove()\n\n```ts\nremove(): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:3755\n\nRemoves node.\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.remove\n```\n\n##### replaceWith()\n\n```ts\nreplaceWith(...nodes): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:3761\n\nReplaces node with nodes, while replacing strings in nodes with equivalent Text nodes.\n\nThrows a \"HierarchyRequestError\" DOMException if the constraints of the node tree are violated.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| ...`nodes` | (`string` \\| `Node`)[] |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.replaceWith\n```\n\n##### attachShadow()\n\n```ts\nattachShadow(init): ShadowRoot;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5074\n\nCreates a shadow root for element and returns it.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `init` | `ShadowRootInit` |\n\n###### Returns\n\n`ShadowRoot`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.attachShadow\n```\n\n##### checkVisibility()\n\n```ts\ncheckVisibility(options?): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5075\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `CheckVisibilityOptions` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.checkVisibility\n```\n\n##### closest()\n\n###### Call Signature\n\n```ts\nclosest<K>(selector): null | HTMLElementTagNameMap[K];\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5077\n\nReturns the first (starting at element) inclusive ancestor that matches selectors, and null otherwise.\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `HTMLElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selector` | `K` |\n\n###### Returns\n\n`null` \\| `HTMLElementTagNameMap`\\[`K`\\]\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.closest\n```\n\n###### Call Signature\n\n```ts\nclosest<K>(selector): null | SVGElementTagNameMap[K];\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5078\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `SVGElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selector` | `K` |\n\n###### Returns\n\n`null` \\| `SVGElementTagNameMap`\\[`K`\\]\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.closest\n```\n\n###### Call Signature\n\n```ts\nclosest<K>(selector): null | MathMLElementTagNameMap[K];\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5079\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `MathMLElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selector` | `K` |\n\n###### Returns\n\n`null` \\| `MathMLElementTagNameMap`\\[`K`\\]\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.closest\n```\n\n###### Call Signature\n\n```ts\nclosest<E>(selectors): null | E;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5080\n\n###### Type Parameters\n\n| Type Parameter | Default type |\n| ------ | ------ |\n| `E` *extends* `Element`\\<`E`\\> | `Element` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `string` |\n\n###### Returns\n\n`null` \\| `E`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.closest\n```\n\n##### getAttribute()\n\n```ts\ngetAttribute(qualifiedName): null | string;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5082\n\nReturns element's first attribute whose qualified name is qualifiedName, and null if there is no such attribute otherwise.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `string` |\n\n###### Returns\n\n`null` \\| `string`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.getAttribute\n```\n\n##### getAttributeNS()\n\n```ts\ngetAttributeNS(namespace, localName): null | string;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5084\n\nReturns element's attribute whose namespace is namespace and local name is localName, and null if there is no such attribute otherwise.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespace` | `null` \\| `string` |\n| `localName` | `string` |\n\n###### Returns\n\n`null` \\| `string`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.getAttributeNS\n```\n\n##### getAttributeNames()\n\n```ts\ngetAttributeNames(): string[];\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5086\n\nReturns the qualified names of all element's attributes. Can contain duplicates.\n\n###### Returns\n\n`string`[]\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.getAttributeNames\n```\n\n##### getAttributeNode()\n\n```ts\ngetAttributeNode(qualifiedName): null | Attr;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5087\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `string` |\n\n###### Returns\n\n`null` \\| `Attr`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.getAttributeNode\n```\n\n##### getAttributeNodeNS()\n\n```ts\ngetAttributeNodeNS(namespace, localName): null | Attr;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5088\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespace` | `null` \\| `string` |\n| `localName` | `string` |\n\n###### Returns\n\n`null` \\| `Attr`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.getAttributeNodeNS\n```\n\n##### getBoundingClientRect()\n\n```ts\ngetBoundingClientRect(): DOMRect;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5089\n\n###### Returns\n\n`DOMRect`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.getBoundingClientRect\n```\n\n##### getClientRects()\n\n```ts\ngetClientRects(): DOMRectList;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5090\n\n###### Returns\n\n`DOMRectList`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.getClientRects\n```\n\n##### getElementsByClassName()\n\n```ts\ngetElementsByClassName(classNames): HTMLCollectionOf<Element>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5092\n\nReturns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `classNames` | `string` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`Element`\\>\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.getElementsByClassName\n```\n\n##### getElementsByTagName()\n\n###### Call Signature\n\n```ts\ngetElementsByTagName<K>(qualifiedName): HTMLCollectionOf<HTMLElementTagNameMap[K]>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5093\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `HTMLElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `K` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`HTMLElementTagNameMap`\\[`K`\\]\\>\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.getElementsByTagName\n```\n\n###### Call Signature\n\n```ts\ngetElementsByTagName<K>(qualifiedName): HTMLCollectionOf<SVGElementTagNameMap[K]>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5094\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `SVGElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `K` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`SVGElementTagNameMap`\\[`K`\\]\\>\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.getElementsByTagName\n```\n\n###### Call Signature\n\n```ts\ngetElementsByTagName<K>(qualifiedName): HTMLCollectionOf<MathMLElementTagNameMap[K]>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5095\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `MathMLElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `K` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`MathMLElementTagNameMap`\\[`K`\\]\\>\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.getElementsByTagName\n```\n\n###### Call Signature\n\n```ts\ngetElementsByTagName<K>(qualifiedName): HTMLCollectionOf<HTMLElementDeprecatedTagNameMap[K]>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5097\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `HTMLElementDeprecatedTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `K` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`HTMLElementDeprecatedTagNameMap`\\[`K`\\]\\>\n\n###### Deprecated\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.getElementsByTagName\n```\n\n###### Call Signature\n\n```ts\ngetElementsByTagName(qualifiedName): HTMLCollectionOf<Element>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5098\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `string` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`Element`\\>\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.getElementsByTagName\n```\n\n##### getElementsByTagNameNS()\n\n###### Call Signature\n\n```ts\ngetElementsByTagNameNS(namespaceURI, localName): HTMLCollectionOf<HTMLElement>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5099\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespaceURI` | `\"http://www.w3.org/1999/xhtml\"` |\n| `localName` | `string` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`HTMLElement`\\>\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.getElementsByTagNameNS\n```\n\n###### Call Signature\n\n```ts\ngetElementsByTagNameNS(namespaceURI, localName): HTMLCollectionOf<SVGElement>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5100\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespaceURI` | `\"http://www.w3.org/2000/svg\"` |\n| `localName` | `string` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`SVGElement`\\>\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.getElementsByTagNameNS\n```\n\n###### Call Signature\n\n```ts\ngetElementsByTagNameNS(namespaceURI, localName): HTMLCollectionOf<MathMLElement>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5101\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespaceURI` | `\"http://www.w3.org/1998/Math/MathML\"` |\n| `localName` | `string` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`MathMLElement`\\>\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.getElementsByTagNameNS\n```\n\n###### Call Signature\n\n```ts\ngetElementsByTagNameNS(namespace, localName): HTMLCollectionOf<Element>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5102\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespace` | `null` \\| `string` |\n| `localName` | `string` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`Element`\\>\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.getElementsByTagNameNS\n```\n\n##### hasAttribute()\n\n```ts\nhasAttribute(qualifiedName): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5104\n\nReturns true if element has an attribute whose qualified name is qualifiedName, and false otherwise.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `string` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.hasAttribute\n```\n\n##### hasAttributeNS()\n\n```ts\nhasAttributeNS(namespace, localName): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5106\n\nReturns true if element has an attribute whose namespace is namespace and local name is localName.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespace` | `null` \\| `string` |\n| `localName` | `string` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.hasAttributeNS\n```\n\n##### hasAttributes()\n\n```ts\nhasAttributes(): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5108\n\nReturns true if element has attributes, and false otherwise.\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.hasAttributes\n```\n\n##### hasPointerCapture()\n\n```ts\nhasPointerCapture(pointerId): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5109\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `pointerId` | `number` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.hasPointerCapture\n```\n\n##### insertAdjacentElement()\n\n```ts\ninsertAdjacentElement(where, element): null | Element;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5110\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `where` | `InsertPosition` |\n| `element` | `Element` |\n\n###### Returns\n\n`null` \\| `Element`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.insertAdjacentElement\n```\n\n##### insertAdjacentHTML()\n\n```ts\ninsertAdjacentHTML(position, text): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5111\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `position` | `InsertPosition` |\n| `text` | `string` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.insertAdjacentHTML\n```\n\n##### insertAdjacentText()\n\n```ts\ninsertAdjacentText(where, data): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5112\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `where` | `InsertPosition` |\n| `data` | `string` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.insertAdjacentText\n```\n\n##### matches()\n\n```ts\nmatches(selectors): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5114\n\nReturns true if matching selectors against element's root yields element, and false otherwise.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `string` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.matches\n```\n\n##### releasePointerCapture()\n\n```ts\nreleasePointerCapture(pointerId): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5115\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `pointerId` | `number` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.releasePointerCapture\n```\n\n##### removeAttribute()\n\n```ts\nremoveAttribute(qualifiedName): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5117\n\nRemoves element's first attribute whose qualified name is qualifiedName.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `string` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.removeAttribute\n```\n\n##### removeAttributeNS()\n\n```ts\nremoveAttributeNS(namespace, localName): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5119\n\nRemoves element's attribute whose namespace is namespace and local name is localName.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespace` | `null` \\| `string` |\n| `localName` | `string` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.removeAttributeNS\n```\n\n##### removeAttributeNode()\n\n```ts\nremoveAttributeNode(attr): Attr;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5120\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `attr` | `Attr` |\n\n###### Returns\n\n`Attr`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.removeAttributeNode\n```\n\n##### requestFullscreen()\n\n```ts\nrequestFullscreen(options?): Promise<void>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5126\n\nDisplays element fullscreen and resolves promise when done.\n\nWhen supplied, options's navigationUI member indicates whether showing navigation UI while in fullscreen is preferred or not. If set to \"show\", navigation simplicity is preferred over screen space, and if set to \"hide\", more screen space is preferred. User agents are always free to honor user preference over the application's. The default value \"auto\" indicates no application preference.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `FullscreenOptions` |\n\n###### Returns\n\n`Promise`\\<`void`\\>\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.requestFullscreen\n```\n\n##### requestPointerLock()\n\n```ts\nrequestPointerLock(): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5127\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.requestPointerLock\n```\n\n##### scroll()\n\n###### Call Signature\n\n```ts\nscroll(options?): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5128\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `ScrollToOptions` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.scroll\n```\n\n###### Call Signature\n\n```ts\nscroll(x, y): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5129\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `x` | `number` |\n| `y` | `number` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.scroll\n```\n\n##### scrollBy()\n\n###### Call Signature\n\n```ts\nscrollBy(options?): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5130\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `ScrollToOptions` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.scrollBy\n```\n\n###### Call Signature\n\n```ts\nscrollBy(x, y): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5131\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `x` | `number` |\n| `y` | `number` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.scrollBy\n```\n\n##### scrollIntoView()\n\n```ts\nscrollIntoView(arg?): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5132\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `arg?` | `boolean` \\| `ScrollIntoViewOptions` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.scrollIntoView\n```\n\n##### scrollTo()\n\n###### Call Signature\n\n```ts\nscrollTo(options?): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5133\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `ScrollToOptions` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.scrollTo\n```\n\n###### Call Signature\n\n```ts\nscrollTo(x, y): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5134\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `x` | `number` |\n| `y` | `number` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.scrollTo\n```\n\n##### setAttribute()\n\n```ts\nsetAttribute(qualifiedName, value): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5136\n\nSets the value of element's first attribute whose qualified name is qualifiedName to value.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `string` |\n| `value` | `string` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.setAttribute\n```\n\n##### setAttributeNS()\n\n```ts\nsetAttributeNS(\n   namespace, \n   qualifiedName, \n   value): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5138\n\nSets the value of element's attribute whose namespace is namespace and local name is localName to value.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespace` | `null` \\| `string` |\n| `qualifiedName` | `string` |\n| `value` | `string` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.setAttributeNS\n```\n\n##### setAttributeNode()\n\n```ts\nsetAttributeNode(attr): null | Attr;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5139\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `attr` | `Attr` |\n\n###### Returns\n\n`null` \\| `Attr`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.setAttributeNode\n```\n\n##### setAttributeNodeNS()\n\n```ts\nsetAttributeNodeNS(attr): null | Attr;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5140\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `attr` | `Attr` |\n\n###### Returns\n\n`null` \\| `Attr`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.setAttributeNodeNS\n```\n\n##### setPointerCapture()\n\n```ts\nsetPointerCapture(pointerId): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5141\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `pointerId` | `number` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.setPointerCapture\n```\n\n##### toggleAttribute()\n\n```ts\ntoggleAttribute(qualifiedName, force?): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5147\n\nIf force is not given, \"toggles\" qualifiedName, removing it if it is present and adding it if it is not present. If force is true, adds qualifiedName. If force is false, removes qualifiedName.\n\nReturns true if qualifiedName is now present, and false otherwise.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `string` |\n| `force?` | `boolean` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.toggleAttribute\n```\n\n##### ~~webkitMatchesSelector()~~\n\n```ts\nwebkitMatchesSelector(selectors): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5149\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `string` |\n\n###### Returns\n\n`boolean`\n\n###### Deprecated\n\nThis is a legacy alias of `matches`.\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.webkitMatchesSelector\n```\n\n##### dispatchEvent()\n\n```ts\ndispatchEvent(event): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5344\n\nDispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `event` | `Event` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.dispatchEvent\n```\n\n##### attachInternals()\n\n```ts\nattachInternals(): ElementInternals;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:6573\n\n###### Returns\n\n`ElementInternals`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.attachInternals\n```\n\n##### click()\n\n```ts\nclick(): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:6574\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.click\n```\n\n##### addEventListener()\n\n###### Call Signature\n\n```ts\naddEventListener<K>(\n   type, \n   listener, \n   options?): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:6575\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `HTMLElementEventMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `type` | `K` |\n| `listener` | (`this`, `ev`) => `any` |\n| `options?` | `boolean` \\| `AddEventListenerOptions` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.addEventListener\n```\n\n###### Call Signature\n\n```ts\naddEventListener(\n   type, \n   listener, \n   options?): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:6576\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `type` | `string` |\n| `listener` | `EventListenerOrEventListenerObject` |\n| `options?` | `boolean` \\| `AddEventListenerOptions` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.addEventListener\n```\n\n##### removeEventListener()\n\n###### Call Signature\n\n```ts\nremoveEventListener<K>(\n   type, \n   listener, \n   options?): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:6577\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `HTMLElementEventMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `type` | `K` |\n| `listener` | (`this`, `ev`) => `any` |\n| `options?` | `boolean` \\| `EventListenerOptions` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.removeEventListener\n```\n\n###### Call Signature\n\n```ts\nremoveEventListener(\n   type, \n   listener, \n   options?): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:6578\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `type` | `string` |\n| `listener` | `EventListenerOrEventListenerObject` |\n| `options?` | `boolean` \\| `EventListenerOptions` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.removeEventListener\n```\n\n##### blur()\n\n```ts\nblur(): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:7768\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.blur\n```\n\n##### focus()\n\n```ts\nfocus(options?): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:7769\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `FocusOptions` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.focus\n```\n\n##### appendChild()\n\n```ts\nappendChild<T>(node): T;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10274\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `T` *extends* `Node`\\<`T`\\> |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `node` | `T` |\n\n###### Returns\n\n`T`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.appendChild\n```\n\n##### cloneNode()\n\n```ts\ncloneNode(deep?): Node;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10276\n\nReturns a copy of node. If deep is true, the copy also includes the node's descendants.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `deep?` | `boolean` |\n\n###### Returns\n\n`Node`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.cloneNode\n```\n\n##### compareDocumentPosition()\n\n```ts\ncompareDocumentPosition(other): number;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10278\n\nReturns a bitmask indicating the position of other relative to node.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `other` | `Node` |\n\n###### Returns\n\n`number`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.compareDocumentPosition\n```\n\n##### contains()\n\n```ts\ncontains(other): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10280\n\nReturns true if other is an inclusive descendant of node, and false otherwise.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `other` | `null` \\| `Node` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.contains\n```\n\n##### getRootNode()\n\n```ts\ngetRootNode(options?): Node;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10282\n\nReturns node's root.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `GetRootNodeOptions` |\n\n###### Returns\n\n`Node`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.getRootNode\n```\n\n##### hasChildNodes()\n\n```ts\nhasChildNodes(): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10284\n\nReturns whether node has children.\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.hasChildNodes\n```\n\n##### insertBefore()\n\n```ts\ninsertBefore<T>(node, child): T;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10285\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `T` *extends* `Node`\\<`T`\\> |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `node` | `T` |\n| `child` | `null` \\| `Node` |\n\n###### Returns\n\n`T`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.insertBefore\n```\n\n##### isDefaultNamespace()\n\n```ts\nisDefaultNamespace(namespace): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10286\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespace` | `null` \\| `string` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.isDefaultNamespace\n```\n\n##### isEqualNode()\n\n```ts\nisEqualNode(otherNode): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10288\n\nReturns whether node and otherNode have the same properties.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `otherNode` | `null` \\| `Node` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.isEqualNode\n```\n\n##### isSameNode()\n\n```ts\nisSameNode(otherNode): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10289\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `otherNode` | `null` \\| `Node` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.isSameNode\n```\n\n##### lookupNamespaceURI()\n\n```ts\nlookupNamespaceURI(prefix): null | string;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10290\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `prefix` | `null` \\| `string` |\n\n###### Returns\n\n`null` \\| `string`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.lookupNamespaceURI\n```\n\n##### lookupPrefix()\n\n```ts\nlookupPrefix(namespace): null | string;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10291\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespace` | `null` \\| `string` |\n\n###### Returns\n\n`null` \\| `string`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.lookupPrefix\n```\n\n##### normalize()\n\n```ts\nnormalize(): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10293\n\nRemoves empty exclusive Text nodes and concatenates the data of remaining contiguous exclusive Text nodes into the first of their nodes.\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.normalize\n```\n\n##### removeChild()\n\n```ts\nremoveChild<T>(child): T;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10294\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `T` *extends* `Node`\\<`T`\\> |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `child` | `T` |\n\n###### Returns\n\n`T`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.removeChild\n```\n\n##### replaceChild()\n\n```ts\nreplaceChild<T>(node, child): T;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10295\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `T` *extends* `Node`\\<`T`\\> |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `node` | `Node` |\n| `child` | `T` |\n\n###### Returns\n\n`T`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.replaceChild\n```\n\n##### append()\n\n```ts\nappend(...nodes): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10697\n\nInserts nodes after the last child of node, while replacing strings in nodes with equivalent Text nodes.\n\nThrows a \"HierarchyRequestError\" DOMException if the constraints of the node tree are violated.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| ...`nodes` | (`string` \\| `Node`)[] |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.append\n```\n\n##### prepend()\n\n```ts\nprepend(...nodes): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10703\n\nInserts nodes before the first child of node, while replacing strings in nodes with equivalent Text nodes.\n\nThrows a \"HierarchyRequestError\" DOMException if the constraints of the node tree are violated.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| ...`nodes` | (`string` \\| `Node`)[] |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.prepend\n```\n\n##### querySelector()\n\n###### Call Signature\n\n```ts\nquerySelector<K>(selectors): null | HTMLElementTagNameMap[K];\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10705\n\nReturns the first element that is a descendant of node that matches selectors.\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `HTMLElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `K` |\n\n###### Returns\n\n`null` \\| `HTMLElementTagNameMap`\\[`K`\\]\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.querySelector\n```\n\n###### Call Signature\n\n```ts\nquerySelector<K>(selectors): null | SVGElementTagNameMap[K];\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10706\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `SVGElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `K` |\n\n###### Returns\n\n`null` \\| `SVGElementTagNameMap`\\[`K`\\]\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.querySelector\n```\n\n###### Call Signature\n\n```ts\nquerySelector<K>(selectors): null | MathMLElementTagNameMap[K];\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10707\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `MathMLElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `K` |\n\n###### Returns\n\n`null` \\| `MathMLElementTagNameMap`\\[`K`\\]\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.querySelector\n```\n\n###### Call Signature\n\n```ts\nquerySelector<K>(selectors): null | HTMLElementDeprecatedTagNameMap[K];\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10709\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `HTMLElementDeprecatedTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `K` |\n\n###### Returns\n\n`null` \\| `HTMLElementDeprecatedTagNameMap`\\[`K`\\]\n\n###### Deprecated\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.querySelector\n```\n\n###### Call Signature\n\n```ts\nquerySelector<E>(selectors): null | E;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10710\n\n###### Type Parameters\n\n| Type Parameter | Default type |\n| ------ | ------ |\n| `E` *extends* `Element`\\<`E`\\> | `Element` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `string` |\n\n###### Returns\n\n`null` \\| `E`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.querySelector\n```\n\n##### querySelectorAll()\n\n###### Call Signature\n\n```ts\nquerySelectorAll<K>(selectors): NodeListOf<HTMLElementTagNameMap[K]>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10712\n\nReturns all element descendants of node that match selectors.\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `HTMLElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `K` |\n\n###### Returns\n\n`NodeListOf`\\<`HTMLElementTagNameMap`\\[`K`\\]\\>\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.querySelectorAll\n```\n\n###### Call Signature\n\n```ts\nquerySelectorAll<K>(selectors): NodeListOf<SVGElementTagNameMap[K]>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10713\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `SVGElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `K` |\n\n###### Returns\n\n`NodeListOf`\\<`SVGElementTagNameMap`\\[`K`\\]\\>\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.querySelectorAll\n```\n\n###### Call Signature\n\n```ts\nquerySelectorAll<K>(selectors): NodeListOf<MathMLElementTagNameMap[K]>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10714\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `MathMLElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `K` |\n\n###### Returns\n\n`NodeListOf`\\<`MathMLElementTagNameMap`\\[`K`\\]\\>\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.querySelectorAll\n```\n\n###### Call Signature\n\n```ts\nquerySelectorAll<K>(selectors): NodeListOf<HTMLElementDeprecatedTagNameMap[K]>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10716\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `HTMLElementDeprecatedTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `K` |\n\n###### Returns\n\n`NodeListOf`\\<`HTMLElementDeprecatedTagNameMap`\\[`K`\\]\\>\n\n###### Deprecated\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.querySelectorAll\n```\n\n###### Call Signature\n\n```ts\nquerySelectorAll<E>(selectors): NodeListOf<E>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10717\n\n###### Type Parameters\n\n| Type Parameter | Default type |\n| ------ | ------ |\n| `E` *extends* `Element`\\<`E`\\> | `Element` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `string` |\n\n###### Returns\n\n`NodeListOf`\\<`E`\\>\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.querySelectorAll\n```\n\n##### replaceChildren()\n\n```ts\nreplaceChildren(...nodes): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10723\n\nReplace all children of node with nodes, while replacing strings in nodes with equivalent Text nodes.\n\nThrows a \"HierarchyRequestError\" DOMException if the constraints of the node tree are violated.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| ...`nodes` | (`string` \\| `Node`)[] |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridItemHTMLElement.replaceChildren\n```\n\n#### Properties\n\n| Property | Modifier | Type | Description | Inherited from | Defined in |\n| ------ | ------ | ------ | ------ | ------ | ------ |\n| <a id=\"_griditemcomp\"></a> `_gridItemComp?` | `public` | [`GridstackItemComponent`](#gridstackitemcomponent) | Back-reference to the Angular GridStackItem component | - | [angular/projects/lib/src/lib/gridstack-item.component.ts:16](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack-item.component.ts#L16) |\n| <a id=\"ariaatomic\"></a> `ariaAtomic` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaAtomic` | node\\_modules/typescript/lib/lib.dom.d.ts:2020 |\n| <a id=\"ariaautocomplete\"></a> `ariaAutoComplete` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaAutoComplete` | node\\_modules/typescript/lib/lib.dom.d.ts:2021 |\n| <a id=\"ariabusy\"></a> `ariaBusy` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaBusy` | node\\_modules/typescript/lib/lib.dom.d.ts:2022 |\n| <a id=\"ariachecked\"></a> `ariaChecked` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaChecked` | node\\_modules/typescript/lib/lib.dom.d.ts:2023 |\n| <a id=\"ariacolcount\"></a> `ariaColCount` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaColCount` | node\\_modules/typescript/lib/lib.dom.d.ts:2024 |\n| <a id=\"ariacolindex\"></a> `ariaColIndex` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaColIndex` | node\\_modules/typescript/lib/lib.dom.d.ts:2025 |\n| <a id=\"ariacolspan\"></a> `ariaColSpan` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaColSpan` | node\\_modules/typescript/lib/lib.dom.d.ts:2026 |\n| <a id=\"ariacurrent\"></a> `ariaCurrent` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaCurrent` | node\\_modules/typescript/lib/lib.dom.d.ts:2027 |\n| <a id=\"ariadisabled\"></a> `ariaDisabled` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaDisabled` | node\\_modules/typescript/lib/lib.dom.d.ts:2028 |\n| <a id=\"ariaexpanded\"></a> `ariaExpanded` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaExpanded` | node\\_modules/typescript/lib/lib.dom.d.ts:2029 |\n| <a id=\"ariahaspopup\"></a> `ariaHasPopup` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaHasPopup` | node\\_modules/typescript/lib/lib.dom.d.ts:2030 |\n| <a id=\"ariahidden\"></a> `ariaHidden` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaHidden` | node\\_modules/typescript/lib/lib.dom.d.ts:2031 |\n| <a id=\"ariainvalid\"></a> `ariaInvalid` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaInvalid` | node\\_modules/typescript/lib/lib.dom.d.ts:2032 |\n| <a id=\"ariakeyshortcuts\"></a> `ariaKeyShortcuts` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaKeyShortcuts` | node\\_modules/typescript/lib/lib.dom.d.ts:2033 |\n| <a id=\"arialabel\"></a> `ariaLabel` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaLabel` | node\\_modules/typescript/lib/lib.dom.d.ts:2034 |\n| <a id=\"arialevel\"></a> `ariaLevel` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaLevel` | node\\_modules/typescript/lib/lib.dom.d.ts:2035 |\n| <a id=\"arialive\"></a> `ariaLive` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaLive` | node\\_modules/typescript/lib/lib.dom.d.ts:2036 |\n| <a id=\"ariamodal\"></a> `ariaModal` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaModal` | node\\_modules/typescript/lib/lib.dom.d.ts:2037 |\n| <a id=\"ariamultiline\"></a> `ariaMultiLine` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaMultiLine` | node\\_modules/typescript/lib/lib.dom.d.ts:2038 |\n| <a id=\"ariamultiselectable\"></a> `ariaMultiSelectable` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaMultiSelectable` | node\\_modules/typescript/lib/lib.dom.d.ts:2039 |\n| <a id=\"ariaorientation\"></a> `ariaOrientation` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaOrientation` | node\\_modules/typescript/lib/lib.dom.d.ts:2040 |\n| <a id=\"ariaplaceholder\"></a> `ariaPlaceholder` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaPlaceholder` | node\\_modules/typescript/lib/lib.dom.d.ts:2041 |\n| <a id=\"ariaposinset\"></a> `ariaPosInSet` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaPosInSet` | node\\_modules/typescript/lib/lib.dom.d.ts:2042 |\n| <a id=\"ariapressed\"></a> `ariaPressed` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaPressed` | node\\_modules/typescript/lib/lib.dom.d.ts:2043 |\n| <a id=\"ariareadonly\"></a> `ariaReadOnly` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaReadOnly` | node\\_modules/typescript/lib/lib.dom.d.ts:2044 |\n| <a id=\"ariarequired\"></a> `ariaRequired` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaRequired` | node\\_modules/typescript/lib/lib.dom.d.ts:2045 |\n| <a id=\"ariaroledescription\"></a> `ariaRoleDescription` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaRoleDescription` | node\\_modules/typescript/lib/lib.dom.d.ts:2046 |\n| <a id=\"ariarowcount\"></a> `ariaRowCount` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaRowCount` | node\\_modules/typescript/lib/lib.dom.d.ts:2047 |\n| <a id=\"ariarowindex\"></a> `ariaRowIndex` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaRowIndex` | node\\_modules/typescript/lib/lib.dom.d.ts:2048 |\n| <a id=\"ariarowspan\"></a> `ariaRowSpan` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaRowSpan` | node\\_modules/typescript/lib/lib.dom.d.ts:2049 |\n| <a id=\"ariaselected\"></a> `ariaSelected` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaSelected` | node\\_modules/typescript/lib/lib.dom.d.ts:2050 |\n| <a id=\"ariasetsize\"></a> `ariaSetSize` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaSetSize` | node\\_modules/typescript/lib/lib.dom.d.ts:2051 |\n| <a id=\"ariasort\"></a> `ariaSort` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaSort` | node\\_modules/typescript/lib/lib.dom.d.ts:2052 |\n| <a id=\"ariavaluemax\"></a> `ariaValueMax` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaValueMax` | node\\_modules/typescript/lib/lib.dom.d.ts:2053 |\n| <a id=\"ariavaluemin\"></a> `ariaValueMin` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaValueMin` | node\\_modules/typescript/lib/lib.dom.d.ts:2054 |\n| <a id=\"ariavaluenow\"></a> `ariaValueNow` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaValueNow` | node\\_modules/typescript/lib/lib.dom.d.ts:2055 |\n| <a id=\"ariavaluetext\"></a> `ariaValueText` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.ariaValueText` | node\\_modules/typescript/lib/lib.dom.d.ts:2056 |\n| <a id=\"role\"></a> `role` | `public` | `null` \\| `string` | - | `GridItemHTMLElement.role` | node\\_modules/typescript/lib/lib.dom.d.ts:2057 |\n| <a id=\"attributes\"></a> `attributes` | `readonly` | `NamedNodeMap` | - | `GridItemHTMLElement.attributes` | node\\_modules/typescript/lib/lib.dom.d.ts:5041 |\n| <a id=\"classlist\"></a> `classList` | `readonly` | `DOMTokenList` | Allows for manipulation of element's class content attribute as a set of whitespace-separated tokens through a DOMTokenList object. | `GridItemHTMLElement.classList` | node\\_modules/typescript/lib/lib.dom.d.ts:5043 |\n| <a id=\"classname\"></a> `className` | `public` | `string` | Returns the value of element's class content attribute. Can be set to change it. | `GridItemHTMLElement.className` | node\\_modules/typescript/lib/lib.dom.d.ts:5045 |\n| <a id=\"clientheight\"></a> `clientHeight` | `readonly` | `number` | - | `GridItemHTMLElement.clientHeight` | node\\_modules/typescript/lib/lib.dom.d.ts:5046 |\n| <a id=\"clientleft\"></a> `clientLeft` | `readonly` | `number` | - | `GridItemHTMLElement.clientLeft` | node\\_modules/typescript/lib/lib.dom.d.ts:5047 |\n| <a id=\"clienttop\"></a> `clientTop` | `readonly` | `number` | - | `GridItemHTMLElement.clientTop` | node\\_modules/typescript/lib/lib.dom.d.ts:5048 |\n| <a id=\"clientwidth\"></a> `clientWidth` | `readonly` | `number` | - | `GridItemHTMLElement.clientWidth` | node\\_modules/typescript/lib/lib.dom.d.ts:5049 |\n| <a id=\"id\"></a> `id` | `public` | `string` | Returns the value of element's id content attribute. Can be set to change it. | `GridItemHTMLElement.id` | node\\_modules/typescript/lib/lib.dom.d.ts:5051 |\n| <a id=\"localname\"></a> `localName` | `readonly` | `string` | Returns the local name. | `GridItemHTMLElement.localName` | node\\_modules/typescript/lib/lib.dom.d.ts:5053 |\n| <a id=\"namespaceuri\"></a> `namespaceURI` | `readonly` | `null` \\| `string` | Returns the namespace. | [`GridCompHTMLElement`](gridstack.component.md#gridcomphtmlelement).[`namespaceURI`](gridstack.component.md#namespaceuri) | node\\_modules/typescript/lib/lib.dom.d.ts:5055 |\n| <a id=\"onfullscreenchange\"></a> `onfullscreenchange` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onfullscreenchange` | node\\_modules/typescript/lib/lib.dom.d.ts:5056 |\n| <a id=\"onfullscreenerror\"></a> `onfullscreenerror` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onfullscreenerror` | node\\_modules/typescript/lib/lib.dom.d.ts:5057 |\n| <a id=\"outerhtml\"></a> `outerHTML` | `public` | `string` | - | `GridItemHTMLElement.outerHTML` | node\\_modules/typescript/lib/lib.dom.d.ts:5058 |\n| <a id=\"ownerdocument\"></a> `ownerDocument` | `readonly` | `Document` | Returns the node document. Returns null for documents. | `GridItemHTMLElement.ownerDocument` | node\\_modules/typescript/lib/lib.dom.d.ts:5059 |\n| <a id=\"part\"></a> `part` | `readonly` | `DOMTokenList` | - | `GridItemHTMLElement.part` | node\\_modules/typescript/lib/lib.dom.d.ts:5060 |\n| <a id=\"prefix\"></a> `prefix` | `readonly` | `null` \\| `string` | Returns the namespace prefix. | [`GridCompHTMLElement`](gridstack.component.md#gridcomphtmlelement).[`prefix`](gridstack.component.md#prefix) | node\\_modules/typescript/lib/lib.dom.d.ts:5062 |\n| <a id=\"scrollheight\"></a> `scrollHeight` | `readonly` | `number` | - | `GridItemHTMLElement.scrollHeight` | node\\_modules/typescript/lib/lib.dom.d.ts:5063 |\n| <a id=\"scrollleft\"></a> `scrollLeft` | `public` | `number` | - | `GridItemHTMLElement.scrollLeft` | node\\_modules/typescript/lib/lib.dom.d.ts:5064 |\n| <a id=\"scrolltop\"></a> `scrollTop` | `public` | `number` | - | `GridItemHTMLElement.scrollTop` | node\\_modules/typescript/lib/lib.dom.d.ts:5065 |\n| <a id=\"scrollwidth\"></a> `scrollWidth` | `readonly` | `number` | - | `GridItemHTMLElement.scrollWidth` | node\\_modules/typescript/lib/lib.dom.d.ts:5066 |\n| <a id=\"shadowroot\"></a> `shadowRoot` | `readonly` | `null` \\| `ShadowRoot` | Returns element's shadow root, if any, and if shadow root's mode is \"open\", and null otherwise. | [`GridCompHTMLElement`](gridstack.component.md#gridcomphtmlelement).[`shadowRoot`](gridstack.component.md#shadowroot) | node\\_modules/typescript/lib/lib.dom.d.ts:5068 |\n| <a id=\"slot\"></a> `slot` | `public` | `string` | Returns the value of element's slot content attribute. Can be set to change it. | `GridItemHTMLElement.slot` | node\\_modules/typescript/lib/lib.dom.d.ts:5070 |\n| <a id=\"tagname\"></a> `tagName` | `readonly` | `string` | Returns the HTML-uppercased qualified name. | `GridItemHTMLElement.tagName` | node\\_modules/typescript/lib/lib.dom.d.ts:5072 |\n| <a id=\"style\"></a> `style` | `readonly` | `CSSStyleDeclaration` | - | `GridItemHTMLElement.style` | node\\_modules/typescript/lib/lib.dom.d.ts:5162 |\n| <a id=\"contenteditable\"></a> `contentEditable` | `public` | `string` | - | `GridItemHTMLElement.contentEditable` | node\\_modules/typescript/lib/lib.dom.d.ts:5166 |\n| <a id=\"enterkeyhint\"></a> `enterKeyHint` | `public` | `string` | - | `GridItemHTMLElement.enterKeyHint` | node\\_modules/typescript/lib/lib.dom.d.ts:5167 |\n| <a id=\"inputmode\"></a> `inputMode` | `public` | `string` | - | `GridItemHTMLElement.inputMode` | node\\_modules/typescript/lib/lib.dom.d.ts:5168 |\n| <a id=\"iscontenteditable\"></a> `isContentEditable` | `readonly` | `boolean` | - | `GridItemHTMLElement.isContentEditable` | node\\_modules/typescript/lib/lib.dom.d.ts:5169 |\n| <a id=\"onabort\"></a> `onabort` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user aborts the download. **Param** The event. | `GridItemHTMLElement.onabort` | node\\_modules/typescript/lib/lib.dom.d.ts:5856 |\n| <a id=\"onanimationcancel\"></a> `onanimationcancel` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onanimationcancel` | node\\_modules/typescript/lib/lib.dom.d.ts:5857 |\n| <a id=\"onanimationend\"></a> `onanimationend` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onanimationend` | node\\_modules/typescript/lib/lib.dom.d.ts:5858 |\n| <a id=\"onanimationiteration\"></a> `onanimationiteration` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onanimationiteration` | node\\_modules/typescript/lib/lib.dom.d.ts:5859 |\n| <a id=\"onanimationstart\"></a> `onanimationstart` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onanimationstart` | node\\_modules/typescript/lib/lib.dom.d.ts:5860 |\n| <a id=\"onauxclick\"></a> `onauxclick` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onauxclick` | node\\_modules/typescript/lib/lib.dom.d.ts:5861 |\n| <a id=\"onbeforeinput\"></a> `onbeforeinput` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onbeforeinput` | node\\_modules/typescript/lib/lib.dom.d.ts:5862 |\n| <a id=\"onblur\"></a> `onblur` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the object loses the input focus. **Param** The focus event. | `GridItemHTMLElement.onblur` | node\\_modules/typescript/lib/lib.dom.d.ts:5867 |\n| <a id=\"oncancel\"></a> `oncancel` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.oncancel` | node\\_modules/typescript/lib/lib.dom.d.ts:5868 |\n| <a id=\"oncanplay\"></a> `oncanplay` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when playback is possible, but would require further buffering. **Param** The event. | `GridItemHTMLElement.oncanplay` | node\\_modules/typescript/lib/lib.dom.d.ts:5873 |\n| <a id=\"oncanplaythrough\"></a> `oncanplaythrough` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.oncanplaythrough` | node\\_modules/typescript/lib/lib.dom.d.ts:5874 |\n| <a id=\"onchange\"></a> `onchange` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the contents of the object or selection have changed. **Param** The event. | `GridItemHTMLElement.onchange` | node\\_modules/typescript/lib/lib.dom.d.ts:5879 |\n| <a id=\"onclick\"></a> `onclick` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user clicks the left mouse button on the object **Param** The mouse event. | `GridItemHTMLElement.onclick` | node\\_modules/typescript/lib/lib.dom.d.ts:5884 |\n| <a id=\"onclose\"></a> `onclose` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onclose` | node\\_modules/typescript/lib/lib.dom.d.ts:5885 |\n| <a id=\"oncontextmenu\"></a> `oncontextmenu` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user clicks the right mouse button in the client area, opening the context menu. **Param** The mouse event. | `GridItemHTMLElement.oncontextmenu` | node\\_modules/typescript/lib/lib.dom.d.ts:5890 |\n| <a id=\"oncopy\"></a> `oncopy` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.oncopy` | node\\_modules/typescript/lib/lib.dom.d.ts:5891 |\n| <a id=\"oncuechange\"></a> `oncuechange` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.oncuechange` | node\\_modules/typescript/lib/lib.dom.d.ts:5892 |\n| <a id=\"oncut\"></a> `oncut` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.oncut` | node\\_modules/typescript/lib/lib.dom.d.ts:5893 |\n| <a id=\"ondblclick\"></a> `ondblclick` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user double-clicks the object. **Param** The mouse event. | `GridItemHTMLElement.ondblclick` | node\\_modules/typescript/lib/lib.dom.d.ts:5898 |\n| <a id=\"ondrag\"></a> `ondrag` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires on the source object continuously during a drag operation. **Param** The event. | `GridItemHTMLElement.ondrag` | node\\_modules/typescript/lib/lib.dom.d.ts:5903 |\n| <a id=\"ondragend\"></a> `ondragend` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires on the source object when the user releases the mouse at the close of a drag operation. **Param** The event. | `GridItemHTMLElement.ondragend` | node\\_modules/typescript/lib/lib.dom.d.ts:5908 |\n| <a id=\"ondragenter\"></a> `ondragenter` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires on the target element when the user drags the object to a valid drop target. **Param** The drag event. | `GridItemHTMLElement.ondragenter` | node\\_modules/typescript/lib/lib.dom.d.ts:5913 |\n| <a id=\"ondragleave\"></a> `ondragleave` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. **Param** The drag event. | `GridItemHTMLElement.ondragleave` | node\\_modules/typescript/lib/lib.dom.d.ts:5918 |\n| <a id=\"ondragover\"></a> `ondragover` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires on the target element continuously while the user drags the object over a valid drop target. **Param** The event. | `GridItemHTMLElement.ondragover` | node\\_modules/typescript/lib/lib.dom.d.ts:5923 |\n| <a id=\"ondragstart\"></a> `ondragstart` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires on the source object when the user starts to drag a text selection or selected object. **Param** The event. | `GridItemHTMLElement.ondragstart` | node\\_modules/typescript/lib/lib.dom.d.ts:5928 |\n| <a id=\"ondrop\"></a> `ondrop` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.ondrop` | node\\_modules/typescript/lib/lib.dom.d.ts:5929 |\n| <a id=\"ondurationchange\"></a> `ondurationchange` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the duration attribute is updated. **Param** The event. | `GridItemHTMLElement.ondurationchange` | node\\_modules/typescript/lib/lib.dom.d.ts:5934 |\n| <a id=\"onemptied\"></a> `onemptied` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the media element is reset to its initial state. **Param** The event. | `GridItemHTMLElement.onemptied` | node\\_modules/typescript/lib/lib.dom.d.ts:5939 |\n| <a id=\"onended\"></a> `onended` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the end of playback is reached. **Param** The event | `GridItemHTMLElement.onended` | node\\_modules/typescript/lib/lib.dom.d.ts:5944 |\n| <a id=\"onerror\"></a> `onerror` | `public` | `OnErrorEventHandler` | Fires when an error occurs during object loading. **Param** The event. | `GridItemHTMLElement.onerror` | node\\_modules/typescript/lib/lib.dom.d.ts:5949 |\n| <a id=\"onfocus\"></a> `onfocus` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the object receives focus. **Param** The event. | `GridItemHTMLElement.onfocus` | node\\_modules/typescript/lib/lib.dom.d.ts:5954 |\n| <a id=\"onformdata\"></a> `onformdata` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onformdata` | node\\_modules/typescript/lib/lib.dom.d.ts:5955 |\n| <a id=\"ongotpointercapture\"></a> `ongotpointercapture` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.ongotpointercapture` | node\\_modules/typescript/lib/lib.dom.d.ts:5956 |\n| <a id=\"oninput\"></a> `oninput` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.oninput` | node\\_modules/typescript/lib/lib.dom.d.ts:5957 |\n| <a id=\"oninvalid\"></a> `oninvalid` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.oninvalid` | node\\_modules/typescript/lib/lib.dom.d.ts:5958 |\n| <a id=\"onkeydown\"></a> `onkeydown` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user presses a key. **Param** The keyboard event | `GridItemHTMLElement.onkeydown` | node\\_modules/typescript/lib/lib.dom.d.ts:5963 |\n| <a id=\"onkeypress\"></a> ~~`onkeypress`~~ | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user presses an alphanumeric key. **Param** The event. **Deprecated** | `GridItemHTMLElement.onkeypress` | node\\_modules/typescript/lib/lib.dom.d.ts:5969 |\n| <a id=\"onkeyup\"></a> `onkeyup` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user releases a key. **Param** The keyboard event | `GridItemHTMLElement.onkeyup` | node\\_modules/typescript/lib/lib.dom.d.ts:5974 |\n| <a id=\"onload\"></a> `onload` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires immediately after the browser loads the object. **Param** The event. | `GridItemHTMLElement.onload` | node\\_modules/typescript/lib/lib.dom.d.ts:5979 |\n| <a id=\"onloadeddata\"></a> `onloadeddata` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when media data is loaded at the current playback position. **Param** The event. | `GridItemHTMLElement.onloadeddata` | node\\_modules/typescript/lib/lib.dom.d.ts:5984 |\n| <a id=\"onloadedmetadata\"></a> `onloadedmetadata` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the duration and dimensions of the media have been determined. **Param** The event. | `GridItemHTMLElement.onloadedmetadata` | node\\_modules/typescript/lib/lib.dom.d.ts:5989 |\n| <a id=\"onloadstart\"></a> `onloadstart` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when Internet Explorer begins looking for media data. **Param** The event. | `GridItemHTMLElement.onloadstart` | node\\_modules/typescript/lib/lib.dom.d.ts:5994 |\n| <a id=\"onlostpointercapture\"></a> `onlostpointercapture` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onlostpointercapture` | node\\_modules/typescript/lib/lib.dom.d.ts:5995 |\n| <a id=\"onmousedown\"></a> `onmousedown` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user clicks the object with either mouse button. **Param** The mouse event. | `GridItemHTMLElement.onmousedown` | node\\_modules/typescript/lib/lib.dom.d.ts:6000 |\n| <a id=\"onmouseenter\"></a> `onmouseenter` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onmouseenter` | node\\_modules/typescript/lib/lib.dom.d.ts:6001 |\n| <a id=\"onmouseleave\"></a> `onmouseleave` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onmouseleave` | node\\_modules/typescript/lib/lib.dom.d.ts:6002 |\n| <a id=\"onmousemove\"></a> `onmousemove` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user moves the mouse over the object. **Param** The mouse event. | `GridItemHTMLElement.onmousemove` | node\\_modules/typescript/lib/lib.dom.d.ts:6007 |\n| <a id=\"onmouseout\"></a> `onmouseout` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user moves the mouse pointer outside the boundaries of the object. **Param** The mouse event. | `GridItemHTMLElement.onmouseout` | node\\_modules/typescript/lib/lib.dom.d.ts:6012 |\n| <a id=\"onmouseover\"></a> `onmouseover` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user moves the mouse pointer into the object. **Param** The mouse event. | `GridItemHTMLElement.onmouseover` | node\\_modules/typescript/lib/lib.dom.d.ts:6017 |\n| <a id=\"onmouseup\"></a> `onmouseup` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user releases a mouse button while the mouse is over the object. **Param** The mouse event. | `GridItemHTMLElement.onmouseup` | node\\_modules/typescript/lib/lib.dom.d.ts:6022 |\n| <a id=\"onpaste\"></a> `onpaste` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onpaste` | node\\_modules/typescript/lib/lib.dom.d.ts:6023 |\n| <a id=\"onpause\"></a> `onpause` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when playback is paused. **Param** The event. | `GridItemHTMLElement.onpause` | node\\_modules/typescript/lib/lib.dom.d.ts:6028 |\n| <a id=\"onplay\"></a> `onplay` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the play method is requested. **Param** The event. | `GridItemHTMLElement.onplay` | node\\_modules/typescript/lib/lib.dom.d.ts:6033 |\n| <a id=\"onplaying\"></a> `onplaying` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the audio or video has started playing. **Param** The event. | `GridItemHTMLElement.onplaying` | node\\_modules/typescript/lib/lib.dom.d.ts:6038 |\n| <a id=\"onpointercancel\"></a> `onpointercancel` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onpointercancel` | node\\_modules/typescript/lib/lib.dom.d.ts:6039 |\n| <a id=\"onpointerdown\"></a> `onpointerdown` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onpointerdown` | node\\_modules/typescript/lib/lib.dom.d.ts:6040 |\n| <a id=\"onpointerenter\"></a> `onpointerenter` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onpointerenter` | node\\_modules/typescript/lib/lib.dom.d.ts:6041 |\n| <a id=\"onpointerleave\"></a> `onpointerleave` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onpointerleave` | node\\_modules/typescript/lib/lib.dom.d.ts:6042 |\n| <a id=\"onpointermove\"></a> `onpointermove` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onpointermove` | node\\_modules/typescript/lib/lib.dom.d.ts:6043 |\n| <a id=\"onpointerout\"></a> `onpointerout` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onpointerout` | node\\_modules/typescript/lib/lib.dom.d.ts:6044 |\n| <a id=\"onpointerover\"></a> `onpointerover` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onpointerover` | node\\_modules/typescript/lib/lib.dom.d.ts:6045 |\n| <a id=\"onpointerup\"></a> `onpointerup` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onpointerup` | node\\_modules/typescript/lib/lib.dom.d.ts:6046 |\n| <a id=\"onprogress\"></a> `onprogress` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs to indicate progress while downloading media data. **Param** The event. | `GridItemHTMLElement.onprogress` | node\\_modules/typescript/lib/lib.dom.d.ts:6051 |\n| <a id=\"onratechange\"></a> `onratechange` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the playback rate is increased or decreased. **Param** The event. | `GridItemHTMLElement.onratechange` | node\\_modules/typescript/lib/lib.dom.d.ts:6056 |\n| <a id=\"onreset\"></a> `onreset` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user resets a form. **Param** The event. | `GridItemHTMLElement.onreset` | node\\_modules/typescript/lib/lib.dom.d.ts:6061 |\n| <a id=\"onresize\"></a> `onresize` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onresize` | node\\_modules/typescript/lib/lib.dom.d.ts:6062 |\n| <a id=\"onscroll\"></a> `onscroll` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user repositions the scroll box in the scroll bar on the object. **Param** The event. | `GridItemHTMLElement.onscroll` | node\\_modules/typescript/lib/lib.dom.d.ts:6067 |\n| <a id=\"onsecuritypolicyviolation\"></a> `onsecuritypolicyviolation` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onsecuritypolicyviolation` | node\\_modules/typescript/lib/lib.dom.d.ts:6068 |\n| <a id=\"onseeked\"></a> `onseeked` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the seek operation ends. **Param** The event. | `GridItemHTMLElement.onseeked` | node\\_modules/typescript/lib/lib.dom.d.ts:6073 |\n| <a id=\"onseeking\"></a> `onseeking` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the current playback position is moved. **Param** The event. | `GridItemHTMLElement.onseeking` | node\\_modules/typescript/lib/lib.dom.d.ts:6078 |\n| <a id=\"onselect\"></a> `onselect` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the current selection changes. **Param** The event. | `GridItemHTMLElement.onselect` | node\\_modules/typescript/lib/lib.dom.d.ts:6083 |\n| <a id=\"onselectionchange\"></a> `onselectionchange` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onselectionchange` | node\\_modules/typescript/lib/lib.dom.d.ts:6084 |\n| <a id=\"onselectstart\"></a> `onselectstart` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onselectstart` | node\\_modules/typescript/lib/lib.dom.d.ts:6085 |\n| <a id=\"onslotchange\"></a> `onslotchange` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onslotchange` | node\\_modules/typescript/lib/lib.dom.d.ts:6086 |\n| <a id=\"onstalled\"></a> `onstalled` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the download has stopped. **Param** The event. | `GridItemHTMLElement.onstalled` | node\\_modules/typescript/lib/lib.dom.d.ts:6091 |\n| <a id=\"onsubmit\"></a> `onsubmit` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onsubmit` | node\\_modules/typescript/lib/lib.dom.d.ts:6092 |\n| <a id=\"onsuspend\"></a> `onsuspend` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs if the load operation has been intentionally halted. **Param** The event. | `GridItemHTMLElement.onsuspend` | node\\_modules/typescript/lib/lib.dom.d.ts:6097 |\n| <a id=\"ontimeupdate\"></a> `ontimeupdate` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs to indicate the current playback position. **Param** The event. | `GridItemHTMLElement.ontimeupdate` | node\\_modules/typescript/lib/lib.dom.d.ts:6102 |\n| <a id=\"ontoggle\"></a> `ontoggle` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.ontoggle` | node\\_modules/typescript/lib/lib.dom.d.ts:6103 |\n| <a id=\"ontouchcancel\"></a> `ontouchcancel?` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.ontouchcancel` | node\\_modules/typescript/lib/lib.dom.d.ts:6104 |\n| <a id=\"ontouchend\"></a> `ontouchend?` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.ontouchend` | node\\_modules/typescript/lib/lib.dom.d.ts:6105 |\n| <a id=\"ontouchmove\"></a> `ontouchmove?` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.ontouchmove` | node\\_modules/typescript/lib/lib.dom.d.ts:6106 |\n| <a id=\"ontouchstart\"></a> `ontouchstart?` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.ontouchstart` | node\\_modules/typescript/lib/lib.dom.d.ts:6107 |\n| <a id=\"ontransitioncancel\"></a> `ontransitioncancel` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.ontransitioncancel` | node\\_modules/typescript/lib/lib.dom.d.ts:6108 |\n| <a id=\"ontransitionend\"></a> `ontransitionend` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.ontransitionend` | node\\_modules/typescript/lib/lib.dom.d.ts:6109 |\n| <a id=\"ontransitionrun\"></a> `ontransitionrun` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.ontransitionrun` | node\\_modules/typescript/lib/lib.dom.d.ts:6110 |\n| <a id=\"ontransitionstart\"></a> `ontransitionstart` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.ontransitionstart` | node\\_modules/typescript/lib/lib.dom.d.ts:6111 |\n| <a id=\"onvolumechange\"></a> `onvolumechange` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the volume is changed, or playback is muted or unmuted. **Param** The event. | `GridItemHTMLElement.onvolumechange` | node\\_modules/typescript/lib/lib.dom.d.ts:6116 |\n| <a id=\"onwaiting\"></a> `onwaiting` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when playback stops because the next frame of a video resource is not available. **Param** The event. | `GridItemHTMLElement.onwaiting` | node\\_modules/typescript/lib/lib.dom.d.ts:6121 |\n| <a id=\"onwebkitanimationend\"></a> ~~`onwebkitanimationend`~~ | `public` | `null` \\| (`this`, `ev`) => `any` | **Deprecated** This is a legacy alias of `onanimationend`. | `GridItemHTMLElement.onwebkitanimationend` | node\\_modules/typescript/lib/lib.dom.d.ts:6123 |\n| <a id=\"onwebkitanimationiteration\"></a> ~~`onwebkitanimationiteration`~~ | `public` | `null` \\| (`this`, `ev`) => `any` | **Deprecated** This is a legacy alias of `onanimationiteration`. | `GridItemHTMLElement.onwebkitanimationiteration` | node\\_modules/typescript/lib/lib.dom.d.ts:6125 |\n| <a id=\"onwebkitanimationstart\"></a> ~~`onwebkitanimationstart`~~ | `public` | `null` \\| (`this`, `ev`) => `any` | **Deprecated** This is a legacy alias of `onanimationstart`. | `GridItemHTMLElement.onwebkitanimationstart` | node\\_modules/typescript/lib/lib.dom.d.ts:6127 |\n| <a id=\"onwebkittransitionend\"></a> ~~`onwebkittransitionend`~~ | `public` | `null` \\| (`this`, `ev`) => `any` | **Deprecated** This is a legacy alias of `ontransitionend`. | `GridItemHTMLElement.onwebkittransitionend` | node\\_modules/typescript/lib/lib.dom.d.ts:6129 |\n| <a id=\"onwheel\"></a> `onwheel` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridItemHTMLElement.onwheel` | node\\_modules/typescript/lib/lib.dom.d.ts:6130 |\n| <a id=\"accesskey\"></a> `accessKey` | `public` | `string` | - | `GridItemHTMLElement.accessKey` | node\\_modules/typescript/lib/lib.dom.d.ts:6555 |\n| <a id=\"accesskeylabel\"></a> `accessKeyLabel` | `readonly` | `string` | - | `GridItemHTMLElement.accessKeyLabel` | node\\_modules/typescript/lib/lib.dom.d.ts:6556 |\n| <a id=\"autocapitalize\"></a> `autocapitalize` | `public` | `string` | - | `GridItemHTMLElement.autocapitalize` | node\\_modules/typescript/lib/lib.dom.d.ts:6557 |\n| <a id=\"dir\"></a> `dir` | `public` | `string` | - | `GridItemHTMLElement.dir` | node\\_modules/typescript/lib/lib.dom.d.ts:6558 |\n| <a id=\"draggable\"></a> `draggable` | `public` | `boolean` | - | `GridItemHTMLElement.draggable` | node\\_modules/typescript/lib/lib.dom.d.ts:6559 |\n| <a id=\"hidden\"></a> `hidden` | `public` | `boolean` | - | `GridItemHTMLElement.hidden` | node\\_modules/typescript/lib/lib.dom.d.ts:6560 |\n| <a id=\"inert\"></a> `inert` | `public` | `boolean` | - | `GridItemHTMLElement.inert` | node\\_modules/typescript/lib/lib.dom.d.ts:6561 |\n| <a id=\"innertext\"></a> `innerText` | `public` | `string` | - | `GridItemHTMLElement.innerText` | node\\_modules/typescript/lib/lib.dom.d.ts:6562 |\n| <a id=\"lang\"></a> `lang` | `public` | `string` | - | `GridItemHTMLElement.lang` | node\\_modules/typescript/lib/lib.dom.d.ts:6563 |\n| <a id=\"offsetheight\"></a> `offsetHeight` | `readonly` | `number` | - | `GridItemHTMLElement.offsetHeight` | node\\_modules/typescript/lib/lib.dom.d.ts:6564 |\n| <a id=\"offsetleft\"></a> `offsetLeft` | `readonly` | `number` | - | `GridItemHTMLElement.offsetLeft` | node\\_modules/typescript/lib/lib.dom.d.ts:6565 |\n| <a id=\"offsetparent\"></a> `offsetParent` | `readonly` | `null` \\| `Element` | - | [`GridCompHTMLElement`](gridstack.component.md#gridcomphtmlelement).[`offsetParent`](gridstack.component.md#offsetparent) | node\\_modules/typescript/lib/lib.dom.d.ts:6566 |\n| <a id=\"offsettop\"></a> `offsetTop` | `readonly` | `number` | - | `GridItemHTMLElement.offsetTop` | node\\_modules/typescript/lib/lib.dom.d.ts:6567 |\n| <a id=\"offsetwidth\"></a> `offsetWidth` | `readonly` | `number` | - | `GridItemHTMLElement.offsetWidth` | node\\_modules/typescript/lib/lib.dom.d.ts:6568 |\n| <a id=\"outertext\"></a> `outerText` | `public` | `string` | - | `GridItemHTMLElement.outerText` | node\\_modules/typescript/lib/lib.dom.d.ts:6569 |\n| <a id=\"spellcheck\"></a> `spellcheck` | `public` | `boolean` | - | `GridItemHTMLElement.spellcheck` | node\\_modules/typescript/lib/lib.dom.d.ts:6570 |\n| <a id=\"title\"></a> `title` | `public` | `string` | - | `GridItemHTMLElement.title` | node\\_modules/typescript/lib/lib.dom.d.ts:6571 |\n| <a id=\"translate\"></a> `translate` | `public` | `boolean` | - | `GridItemHTMLElement.translate` | node\\_modules/typescript/lib/lib.dom.d.ts:6572 |\n| <a id=\"autofocus\"></a> `autofocus` | `public` | `boolean` | - | `GridItemHTMLElement.autofocus` | node\\_modules/typescript/lib/lib.dom.d.ts:7764 |\n| <a id=\"dataset\"></a> `dataset` | `readonly` | `DOMStringMap` | - | `GridItemHTMLElement.dataset` | node\\_modules/typescript/lib/lib.dom.d.ts:7765 |\n| <a id=\"nonce\"></a> `nonce?` | `public` | `string` | - | `GridItemHTMLElement.nonce` | node\\_modules/typescript/lib/lib.dom.d.ts:7766 |\n| <a id=\"tabindex\"></a> `tabIndex` | `public` | `number` | - | `GridItemHTMLElement.tabIndex` | node\\_modules/typescript/lib/lib.dom.d.ts:7767 |\n| <a id=\"innerhtml\"></a> `innerHTML` | `public` | `string` | - | `GridItemHTMLElement.innerHTML` | node\\_modules/typescript/lib/lib.dom.d.ts:9130 |\n| <a id=\"baseuri\"></a> `baseURI` | `readonly` | `string` | Returns node's node document's document base URL. | `GridItemHTMLElement.baseURI` | node\\_modules/typescript/lib/lib.dom.d.ts:10249 |\n| <a id=\"childnodes\"></a> `childNodes` | `readonly` | `NodeListOf`\\<`ChildNode`\\> | Returns the children. | `GridItemHTMLElement.childNodes` | node\\_modules/typescript/lib/lib.dom.d.ts:10251 |\n| <a id=\"firstchild\"></a> `firstChild` | `readonly` | `null` \\| `ChildNode` | Returns the first child. | [`GridCompHTMLElement`](gridstack.component.md#gridcomphtmlelement).[`firstChild`](gridstack.component.md#firstchild) | node\\_modules/typescript/lib/lib.dom.d.ts:10253 |\n| <a id=\"isconnected\"></a> `isConnected` | `readonly` | `boolean` | Returns true if node is connected and false otherwise. | `GridItemHTMLElement.isConnected` | node\\_modules/typescript/lib/lib.dom.d.ts:10255 |\n| <a id=\"lastchild\"></a> `lastChild` | `readonly` | `null` \\| `ChildNode` | Returns the last child. | [`GridCompHTMLElement`](gridstack.component.md#gridcomphtmlelement).[`lastChild`](gridstack.component.md#lastchild) | node\\_modules/typescript/lib/lib.dom.d.ts:10257 |\n| <a id=\"nextsibling\"></a> `nextSibling` | `readonly` | `null` \\| `ChildNode` | Returns the next sibling. | [`GridCompHTMLElement`](gridstack.component.md#gridcomphtmlelement).[`nextSibling`](gridstack.component.md#nextsibling) | node\\_modules/typescript/lib/lib.dom.d.ts:10259 |\n| <a id=\"nodename\"></a> `nodeName` | `readonly` | `string` | Returns a string appropriate for the type of node. | `GridItemHTMLElement.nodeName` | node\\_modules/typescript/lib/lib.dom.d.ts:10261 |\n| <a id=\"nodetype\"></a> `nodeType` | `readonly` | `number` | Returns the type of node. | `GridItemHTMLElement.nodeType` | node\\_modules/typescript/lib/lib.dom.d.ts:10263 |\n| <a id=\"nodevalue\"></a> `nodeValue` | `public` | `null` \\| `string` | - | [`GridCompHTMLElement`](gridstack.component.md#gridcomphtmlelement).[`nodeValue`](gridstack.component.md#nodevalue) | node\\_modules/typescript/lib/lib.dom.d.ts:10264 |\n| <a id=\"parentelement\"></a> `parentElement` | `readonly` | `null` \\| `HTMLElement` | Returns the parent element. | [`GridCompHTMLElement`](gridstack.component.md#gridcomphtmlelement).[`parentElement`](gridstack.component.md#parentelement) | node\\_modules/typescript/lib/lib.dom.d.ts:10268 |\n| <a id=\"parentnode\"></a> `parentNode` | `readonly` | `null` \\| `ParentNode` | Returns the parent. | [`GridCompHTMLElement`](gridstack.component.md#gridcomphtmlelement).[`parentNode`](gridstack.component.md#parentnode) | node\\_modules/typescript/lib/lib.dom.d.ts:10270 |\n| <a id=\"previoussibling\"></a> `previousSibling` | `readonly` | `null` \\| `ChildNode` | Returns the previous sibling. | [`GridCompHTMLElement`](gridstack.component.md#gridcomphtmlelement).[`previousSibling`](gridstack.component.md#previoussibling) | node\\_modules/typescript/lib/lib.dom.d.ts:10272 |\n| <a id=\"textcontent\"></a> `textContent` | `public` | `null` \\| `string` | - | [`GridCompHTMLElement`](gridstack.component.md#gridcomphtmlelement).[`textContent`](gridstack.component.md#textcontent) | node\\_modules/typescript/lib/lib.dom.d.ts:10273 |\n| <a id=\"element_node\"></a> `ELEMENT_NODE` | `readonly` | `1` | node is an element. | `GridItemHTMLElement.ELEMENT_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10297 |\n| <a id=\"attribute_node\"></a> `ATTRIBUTE_NODE` | `readonly` | `2` | - | `GridItemHTMLElement.ATTRIBUTE_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10298 |\n| <a id=\"text_node\"></a> `TEXT_NODE` | `readonly` | `3` | node is a Text node. | `GridItemHTMLElement.TEXT_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10300 |\n| <a id=\"cdata_section_node\"></a> `CDATA_SECTION_NODE` | `readonly` | `4` | node is a CDATASection node. | `GridItemHTMLElement.CDATA_SECTION_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10302 |\n| <a id=\"entity_reference_node\"></a> `ENTITY_REFERENCE_NODE` | `readonly` | `5` | - | `GridItemHTMLElement.ENTITY_REFERENCE_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10303 |\n| <a id=\"entity_node\"></a> `ENTITY_NODE` | `readonly` | `6` | - | `GridItemHTMLElement.ENTITY_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10304 |\n| <a id=\"processing_instruction_node\"></a> `PROCESSING_INSTRUCTION_NODE` | `readonly` | `7` | node is a ProcessingInstruction node. | `GridItemHTMLElement.PROCESSING_INSTRUCTION_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10306 |\n| <a id=\"comment_node\"></a> `COMMENT_NODE` | `readonly` | `8` | node is a Comment node. | `GridItemHTMLElement.COMMENT_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10308 |\n| <a id=\"document_node\"></a> `DOCUMENT_NODE` | `readonly` | `9` | node is a document. | `GridItemHTMLElement.DOCUMENT_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10310 |\n| <a id=\"document_type_node\"></a> `DOCUMENT_TYPE_NODE` | `readonly` | `10` | node is a doctype. | `GridItemHTMLElement.DOCUMENT_TYPE_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10312 |\n| <a id=\"document_fragment_node\"></a> `DOCUMENT_FRAGMENT_NODE` | `readonly` | `11` | node is a DocumentFragment node. | `GridItemHTMLElement.DOCUMENT_FRAGMENT_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10314 |\n| <a id=\"notation_node\"></a> `NOTATION_NODE` | `readonly` | `12` | - | `GridItemHTMLElement.NOTATION_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10315 |\n| <a id=\"document_position_disconnected\"></a> `DOCUMENT_POSITION_DISCONNECTED` | `readonly` | `1` | Set when node and other are not in the same tree. | `GridItemHTMLElement.DOCUMENT_POSITION_DISCONNECTED` | node\\_modules/typescript/lib/lib.dom.d.ts:10317 |\n| <a id=\"document_position_preceding\"></a> `DOCUMENT_POSITION_PRECEDING` | `readonly` | `2` | Set when other is preceding node. | `GridItemHTMLElement.DOCUMENT_POSITION_PRECEDING` | node\\_modules/typescript/lib/lib.dom.d.ts:10319 |\n| <a id=\"document_position_following\"></a> `DOCUMENT_POSITION_FOLLOWING` | `readonly` | `4` | Set when other is following node. | `GridItemHTMLElement.DOCUMENT_POSITION_FOLLOWING` | node\\_modules/typescript/lib/lib.dom.d.ts:10321 |\n| <a id=\"document_position_contains\"></a> `DOCUMENT_POSITION_CONTAINS` | `readonly` | `8` | Set when other is an ancestor of node. | `GridItemHTMLElement.DOCUMENT_POSITION_CONTAINS` | node\\_modules/typescript/lib/lib.dom.d.ts:10323 |\n| <a id=\"document_position_contained_by\"></a> `DOCUMENT_POSITION_CONTAINED_BY` | `readonly` | `16` | Set when other is a descendant of node. | `GridItemHTMLElement.DOCUMENT_POSITION_CONTAINED_BY` | node\\_modules/typescript/lib/lib.dom.d.ts:10325 |\n| <a id=\"document_position_implementation_specific\"></a> `DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC` | `readonly` | `32` | - | `GridItemHTMLElement.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC` | node\\_modules/typescript/lib/lib.dom.d.ts:10326 |\n| <a id=\"nextelementsibling\"></a> `nextElementSibling` | `readonly` | `null` \\| `Element` | Returns the first following sibling that is an element, and null otherwise. | `GridItemHTMLElement.nextElementSibling` | node\\_modules/typescript/lib/lib.dom.d.ts:10416 |\n| <a id=\"previouselementsibling\"></a> `previousElementSibling` | `readonly` | `null` \\| `Element` | Returns the first preceding sibling that is an element, and null otherwise. | `GridItemHTMLElement.previousElementSibling` | node\\_modules/typescript/lib/lib.dom.d.ts:10418 |\n| <a id=\"childelementcount\"></a> `childElementCount` | `readonly` | `number` | - | `GridItemHTMLElement.childElementCount` | node\\_modules/typescript/lib/lib.dom.d.ts:10685 |\n| <a id=\"children\"></a> `children` | `readonly` | `HTMLCollection` | Returns the child elements. | `GridItemHTMLElement.children` | node\\_modules/typescript/lib/lib.dom.d.ts:10687 |\n| <a id=\"firstelementchild\"></a> `firstElementChild` | `readonly` | `null` \\| `Element` | Returns the first child that is an element, and null otherwise. | [`GridCompHTMLElement`](gridstack.component.md#gridcomphtmlelement).[`firstElementChild`](gridstack.component.md#firstelementchild) | node\\_modules/typescript/lib/lib.dom.d.ts:10689 |\n| <a id=\"lastelementchild\"></a> `lastElementChild` | `readonly` | `null` \\| `Element` | Returns the last child that is an element, and null otherwise. | [`GridCompHTMLElement`](gridstack.component.md#gridcomphtmlelement).[`lastElementChild`](gridstack.component.md#lastelementchild) | node\\_modules/typescript/lib/lib.dom.d.ts:10691 |\n| <a id=\"assignedslot\"></a> `assignedSlot` | `readonly` | `null` \\| `HTMLSlotElement` | - | `GridItemHTMLElement.assignedSlot` | node\\_modules/typescript/lib/lib.dom.d.ts:13933 |\n"
  },
  {
    "path": "angular/doc/api/gridstack.component.md",
    "content": "# gridstack.component\n\n## Classes\n\n### GridstackComponent\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:85](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L85)\n\nAngular component wrapper for GridStack.\n\nThis component provides Angular integration for GridStack grids, handling:\n- Grid initialization and lifecycle\n- Dynamic component creation and management\n- Event binding and emission\n- Integration with Angular change detection\n\nUse in combination with GridstackItemComponent for individual grid items.\n\n#### Example\n\n```html\n<gridstack [options]=\"gridOptions\" (change)=\"onGridChange($event)\">\n  <div empty-content>Drag widgets here</div>\n</gridstack>\n```\n\n#### Implements\n\n- `OnInit`\n- `AfterContentInit`\n- `OnDestroy`\n\n#### Accessors\n\n##### options\n\n###### Get Signature\n\n```ts\nget options(): GridStackOptions;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:120](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L120)\n\nGet the current running grid options\n\n###### Returns\n\n`GridStackOptions`\n\n###### Set Signature\n\n```ts\nset options(o): void;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:112](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L112)\n\nGrid configuration options.\nCan be set before grid initialization or updated after grid is created.\n\n###### Example\n\n```typescript\ngridOptions: GridStackOptions = {\n  column: 12,\n  cellHeight: 'auto',\n  animate: true\n};\n```\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `o` | `GridStackOptions` |\n\n###### Returns\n\n`void`\n\n##### el\n\n###### Get Signature\n\n```ts\nget el(): GridCompHTMLElement;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:190](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L190)\n\nGet the native DOM element that contains grid-specific fields.\nThis element has GridStack properties attached to it.\n\n###### Returns\n\n[`GridCompHTMLElement`](#gridcomphtmlelement)\n\n##### grid\n\n###### Get Signature\n\n```ts\nget grid(): undefined | GridStack;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:201](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L201)\n\nGet the underlying GridStack instance.\nUse this to access GridStack API methods directly.\n\n###### Example\n\n```typescript\nthis.gridComponent.grid.addWidget({x: 0, y: 0, w: 2, h: 1});\n```\n\n###### Returns\n\n`undefined` \\| `GridStack`\n\n#### Constructors\n\n##### Constructor\n\n```ts\nnew GridstackComponent(elementRef): GridstackComponent;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:253](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L253)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `elementRef` | `ElementRef`\\<[`GridCompHTMLElement`](#gridcomphtmlelement)\\> |\n\n###### Returns\n\n[`GridstackComponent`](#gridstackcomponent)\n\n#### Methods\n\n##### addComponentToSelectorType()\n\n```ts\nstatic addComponentToSelectorType(typeList): void;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:234](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L234)\n\nRegister a list of Angular components for dynamic creation.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `typeList` | `Type`\\<`object`\\>[] | Array of component types to register |\n\n###### Returns\n\n`void`\n\n###### Example\n\n```typescript\nGridstackComponent.addComponentToSelectorType([\n  MyWidgetComponent,\n  AnotherWidgetComponent\n]);\n```\n\n##### getSelector()\n\n```ts\nstatic getSelector(type): string;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:243](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L243)\n\nExtract the selector string from an Angular component type.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `type` | `Type`\\<`object`\\> | The component type to get selector from |\n\n###### Returns\n\n`string`\n\nThe component's selector string\n\n##### ngOnInit()\n\n```ts\nngOnInit(): void;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:267](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L267)\n\nA callback method that is invoked immediately after the\ndefault change detector has checked the directive's\ndata-bound properties for the first time,\nand before any of the view or content children have been checked.\nIt is invoked only once when the directive is instantiated.\n\n###### Returns\n\n`void`\n\n###### Implementation of\n\n```ts\nOnInit.ngOnInit\n```\n\n##### ngAfterContentInit()\n\n```ts\nngAfterContentInit(): void;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:277](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L277)\n\nwait until after all DOM is ready to init gridstack children (after angular ngFor and sub-components run first)\n\n###### Returns\n\n`void`\n\n###### Implementation of\n\n```ts\nAfterContentInit.ngAfterContentInit\n```\n\n##### ngOnDestroy()\n\n```ts\nngOnDestroy(): void;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:285](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L285)\n\nA callback method that performs custom clean-up, invoked immediately\nbefore a directive, pipe, or service instance is destroyed.\n\n###### Returns\n\n`void`\n\n###### Implementation of\n\n```ts\nOnDestroy.ngOnDestroy\n```\n\n##### updateAll()\n\n```ts\nupdateAll(): void;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:299](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L299)\n\ncalled when the TEMPLATE (not recommended) list of items changes - get a list of nodes and\nupdate the layout accordingly (which will take care of adding/removing items changed by Angular)\n\n###### Returns\n\n`void`\n\n##### checkEmpty()\n\n```ts\ncheckEmpty(): void;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:310](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L310)\n\ncheck if the grid is empty, if so show alternative content\n\n###### Returns\n\n`void`\n\n##### hookEvents()\n\n```ts\nprotected hookEvents(grid?): void;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:316](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L316)\n\nget all known events as easy to use Outputs for convenience\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `grid?` | `GridStack` |\n\n###### Returns\n\n`void`\n\n##### unhookEvents()\n\n```ts\nprotected unhookEvents(grid?): void;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:343](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L343)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `grid?` | `GridStack` |\n\n###### Returns\n\n`void`\n\n#### Properties\n\n| Property | Modifier | Type | Default value | Description | Defined in |\n| ------ | ------ | ------ | ------ | ------ | ------ |\n| <a id=\"gridstackitems\"></a> `gridstackItems?` | `public` | `QueryList`\\<[`GridstackItemComponent`](gridstack-item.component.md#gridstackitemcomponent)\\> | `undefined` | List of template-based grid items (not recommended approach). Used to sync between DOM and GridStack internals when items are defined in templates. Prefer dynamic component creation instead. | [angular/projects/lib/src/lib/gridstack.component.ts:92](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L92) |\n| <a id=\"container\"></a> `container?` | `public` | `ViewContainerRef` | `undefined` | Container for dynamic component creation (recommended approach). Used to append grid items programmatically at runtime. | [angular/projects/lib/src/lib/gridstack.component.ts:97](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L97) |\n| <a id=\"isempty\"></a> `isEmpty?` | `public` | `boolean` | `undefined` | Controls whether empty content should be displayed. Set to true to show ng-content with 'empty-content' selector when grid has no items. **Example** `<gridstack [isEmpty]=\"gridItems.length === 0\"> <div empty-content>Drag widgets here to get started</div> </gridstack>` | [angular/projects/lib/src/lib/gridstack.component.ts:133](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L133) |\n| <a id=\"addedcb\"></a> `addedCB` | `public` | `EventEmitter`\\<[`nodesCB`](#nodescb)\\> | `undefined` | Emitted when widgets are added to the grid | [angular/projects/lib/src/lib/gridstack.component.ts:151](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L151) |\n| <a id=\"changecb\"></a> `changeCB` | `public` | `EventEmitter`\\<[`nodesCB`](#nodescb)\\> | `undefined` | Emitted when grid layout changes | [angular/projects/lib/src/lib/gridstack.component.ts:154](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L154) |\n| <a id=\"disablecb\"></a> `disableCB` | `public` | `EventEmitter`\\<[`eventCB`](#eventcb)\\> | `undefined` | Emitted when grid is disabled | [angular/projects/lib/src/lib/gridstack.component.ts:157](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L157) |\n| <a id=\"dragcb\"></a> `dragCB` | `public` | `EventEmitter`\\<[`elementCB`](#elementcb)\\> | `undefined` | Emitted during widget drag operations | [angular/projects/lib/src/lib/gridstack.component.ts:160](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L160) |\n| <a id=\"dragstartcb\"></a> `dragStartCB` | `public` | `EventEmitter`\\<[`elementCB`](#elementcb)\\> | `undefined` | Emitted when widget drag starts | [angular/projects/lib/src/lib/gridstack.component.ts:163](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L163) |\n| <a id=\"dragstopcb\"></a> `dragStopCB` | `public` | `EventEmitter`\\<[`elementCB`](#elementcb)\\> | `undefined` | Emitted when widget drag stops | [angular/projects/lib/src/lib/gridstack.component.ts:166](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L166) |\n| <a id=\"droppedcb-1\"></a> `droppedCB` | `public` | `EventEmitter`\\<[`droppedCB`](#droppedcb)\\> | `undefined` | Emitted when widget is dropped | [angular/projects/lib/src/lib/gridstack.component.ts:169](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L169) |\n| <a id=\"enablecb\"></a> `enableCB` | `public` | `EventEmitter`\\<[`eventCB`](#eventcb)\\> | `undefined` | Emitted when grid is enabled | [angular/projects/lib/src/lib/gridstack.component.ts:172](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L172) |\n| <a id=\"removedcb\"></a> `removedCB` | `public` | `EventEmitter`\\<[`nodesCB`](#nodescb)\\> | `undefined` | Emitted when widgets are removed from the grid | [angular/projects/lib/src/lib/gridstack.component.ts:175](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L175) |\n| <a id=\"resizecb\"></a> `resizeCB` | `public` | `EventEmitter`\\<[`elementCB`](#elementcb)\\> | `undefined` | Emitted during widget resize operations | [angular/projects/lib/src/lib/gridstack.component.ts:178](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L178) |\n| <a id=\"resizestartcb\"></a> `resizeStartCB` | `public` | `EventEmitter`\\<[`elementCB`](#elementcb)\\> | `undefined` | Emitted when widget resize starts | [angular/projects/lib/src/lib/gridstack.component.ts:181](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L181) |\n| <a id=\"resizestopcb\"></a> `resizeStopCB` | `public` | `EventEmitter`\\<[`elementCB`](#elementcb)\\> | `undefined` | Emitted when widget resize stops | [angular/projects/lib/src/lib/gridstack.component.ts:184](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L184) |\n| <a id=\"ref\"></a> `ref` | `public` | \\| `undefined` \\| `ComponentRef`\\<[`GridstackComponent`](#gridstackcomponent)\\> | `undefined` | Component reference for dynamic component removal. Used internally when this component is created dynamically. | [angular/projects/lib/src/lib/gridstack.component.ts:207](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L207) |\n| <a id=\"selectortotype-1\"></a> `selectorToType` | `static` | [`SelectorToType`](#selectortotype) | `{}` | Mapping of component selectors to their types for dynamic creation. This enables dynamic component instantiation from string selectors. Angular doesn't provide public access to this mapping, so we maintain our own. **Example** `GridstackComponent.addComponentToSelectorType([MyWidgetComponent]);` | [angular/projects/lib/src/lib/gridstack.component.ts:220](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L220) |\n| <a id=\"_options\"></a> `_options?` | `protected` | `GridStackOptions` | `undefined` | - | [angular/projects/lib/src/lib/gridstack.component.ts:248](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L248) |\n| <a id=\"_grid\"></a> `_grid?` | `protected` | `GridStack` | `undefined` | - | [angular/projects/lib/src/lib/gridstack.component.ts:249](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L249) |\n| <a id=\"_sub\"></a> `_sub` | `protected` | `undefined` \\| `Subscription` | `undefined` | - | [angular/projects/lib/src/lib/gridstack.component.ts:250](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L250) |\n| <a id=\"loaded\"></a> `loaded?` | `protected` | `boolean` | `undefined` | - | [angular/projects/lib/src/lib/gridstack.component.ts:251](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L251) |\n| <a id=\"elementref\"></a> `elementRef` | `readonly` | `ElementRef`\\<[`GridCompHTMLElement`](#gridcomphtmlelement)\\> | `undefined` | - | [angular/projects/lib/src/lib/gridstack.component.ts:253](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L253) |\n\n## Interfaces\n\n### GridCompHTMLElement\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:39](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L39)\n\nExtended HTMLElement interface for the grid container.\nStores a back-reference to the Angular component for integration purposes.\n\n#### Extends\n\n- `GridHTMLElement`\n\n#### Methods\n\n##### animate()\n\n```ts\nanimate(keyframes, options?): Animation;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:2146\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `keyframes` | `null` \\| `Keyframe`[] \\| `PropertyIndexedKeyframes` |\n| `options?` | `number` \\| `KeyframeAnimationOptions` |\n\n###### Returns\n\n`Animation`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.animate\n```\n\n##### getAnimations()\n\n```ts\ngetAnimations(options?): Animation[];\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:2147\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `GetAnimationsOptions` |\n\n###### Returns\n\n`Animation`[]\n\n###### Inherited from\n\n```ts\nGridHTMLElement.getAnimations\n```\n\n##### after()\n\n```ts\nafter(...nodes): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:3747\n\nInserts nodes just after node, while replacing strings in nodes with equivalent Text nodes.\n\nThrows a \"HierarchyRequestError\" DOMException if the constraints of the node tree are violated.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| ...`nodes` | (`string` \\| `Node`)[] |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.after\n```\n\n##### before()\n\n```ts\nbefore(...nodes): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:3753\n\nInserts nodes just before node, while replacing strings in nodes with equivalent Text nodes.\n\nThrows a \"HierarchyRequestError\" DOMException if the constraints of the node tree are violated.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| ...`nodes` | (`string` \\| `Node`)[] |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.before\n```\n\n##### remove()\n\n```ts\nremove(): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:3755\n\nRemoves node.\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.remove\n```\n\n##### replaceWith()\n\n```ts\nreplaceWith(...nodes): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:3761\n\nReplaces node with nodes, while replacing strings in nodes with equivalent Text nodes.\n\nThrows a \"HierarchyRequestError\" DOMException if the constraints of the node tree are violated.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| ...`nodes` | (`string` \\| `Node`)[] |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.replaceWith\n```\n\n##### attachShadow()\n\n```ts\nattachShadow(init): ShadowRoot;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5074\n\nCreates a shadow root for element and returns it.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `init` | `ShadowRootInit` |\n\n###### Returns\n\n`ShadowRoot`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.attachShadow\n```\n\n##### checkVisibility()\n\n```ts\ncheckVisibility(options?): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5075\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `CheckVisibilityOptions` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.checkVisibility\n```\n\n##### closest()\n\n###### Call Signature\n\n```ts\nclosest<K>(selector): null | HTMLElementTagNameMap[K];\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5077\n\nReturns the first (starting at element) inclusive ancestor that matches selectors, and null otherwise.\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `HTMLElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selector` | `K` |\n\n###### Returns\n\n`null` \\| `HTMLElementTagNameMap`\\[`K`\\]\n\n###### Inherited from\n\n```ts\nGridHTMLElement.closest\n```\n\n###### Call Signature\n\n```ts\nclosest<K>(selector): null | SVGElementTagNameMap[K];\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5078\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `SVGElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selector` | `K` |\n\n###### Returns\n\n`null` \\| `SVGElementTagNameMap`\\[`K`\\]\n\n###### Inherited from\n\n```ts\nGridHTMLElement.closest\n```\n\n###### Call Signature\n\n```ts\nclosest<K>(selector): null | MathMLElementTagNameMap[K];\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5079\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `MathMLElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selector` | `K` |\n\n###### Returns\n\n`null` \\| `MathMLElementTagNameMap`\\[`K`\\]\n\n###### Inherited from\n\n```ts\nGridHTMLElement.closest\n```\n\n###### Call Signature\n\n```ts\nclosest<E>(selectors): null | E;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5080\n\n###### Type Parameters\n\n| Type Parameter | Default type |\n| ------ | ------ |\n| `E` *extends* `Element`\\<`E`\\> | `Element` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `string` |\n\n###### Returns\n\n`null` \\| `E`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.closest\n```\n\n##### getAttribute()\n\n```ts\ngetAttribute(qualifiedName): null | string;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5082\n\nReturns element's first attribute whose qualified name is qualifiedName, and null if there is no such attribute otherwise.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `string` |\n\n###### Returns\n\n`null` \\| `string`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.getAttribute\n```\n\n##### getAttributeNS()\n\n```ts\ngetAttributeNS(namespace, localName): null | string;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5084\n\nReturns element's attribute whose namespace is namespace and local name is localName, and null if there is no such attribute otherwise.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespace` | `null` \\| `string` |\n| `localName` | `string` |\n\n###### Returns\n\n`null` \\| `string`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.getAttributeNS\n```\n\n##### getAttributeNames()\n\n```ts\ngetAttributeNames(): string[];\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5086\n\nReturns the qualified names of all element's attributes. Can contain duplicates.\n\n###### Returns\n\n`string`[]\n\n###### Inherited from\n\n```ts\nGridHTMLElement.getAttributeNames\n```\n\n##### getAttributeNode()\n\n```ts\ngetAttributeNode(qualifiedName): null | Attr;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5087\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `string` |\n\n###### Returns\n\n`null` \\| `Attr`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.getAttributeNode\n```\n\n##### getAttributeNodeNS()\n\n```ts\ngetAttributeNodeNS(namespace, localName): null | Attr;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5088\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespace` | `null` \\| `string` |\n| `localName` | `string` |\n\n###### Returns\n\n`null` \\| `Attr`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.getAttributeNodeNS\n```\n\n##### getBoundingClientRect()\n\n```ts\ngetBoundingClientRect(): DOMRect;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5089\n\n###### Returns\n\n`DOMRect`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.getBoundingClientRect\n```\n\n##### getClientRects()\n\n```ts\ngetClientRects(): DOMRectList;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5090\n\n###### Returns\n\n`DOMRectList`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.getClientRects\n```\n\n##### getElementsByClassName()\n\n```ts\ngetElementsByClassName(classNames): HTMLCollectionOf<Element>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5092\n\nReturns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `classNames` | `string` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`Element`\\>\n\n###### Inherited from\n\n```ts\nGridHTMLElement.getElementsByClassName\n```\n\n##### getElementsByTagName()\n\n###### Call Signature\n\n```ts\ngetElementsByTagName<K>(qualifiedName): HTMLCollectionOf<HTMLElementTagNameMap[K]>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5093\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `HTMLElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `K` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`HTMLElementTagNameMap`\\[`K`\\]\\>\n\n###### Inherited from\n\n```ts\nGridHTMLElement.getElementsByTagName\n```\n\n###### Call Signature\n\n```ts\ngetElementsByTagName<K>(qualifiedName): HTMLCollectionOf<SVGElementTagNameMap[K]>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5094\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `SVGElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `K` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`SVGElementTagNameMap`\\[`K`\\]\\>\n\n###### Inherited from\n\n```ts\nGridHTMLElement.getElementsByTagName\n```\n\n###### Call Signature\n\n```ts\ngetElementsByTagName<K>(qualifiedName): HTMLCollectionOf<MathMLElementTagNameMap[K]>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5095\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `MathMLElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `K` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`MathMLElementTagNameMap`\\[`K`\\]\\>\n\n###### Inherited from\n\n```ts\nGridHTMLElement.getElementsByTagName\n```\n\n###### Call Signature\n\n```ts\ngetElementsByTagName<K>(qualifiedName): HTMLCollectionOf<HTMLElementDeprecatedTagNameMap[K]>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5097\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `HTMLElementDeprecatedTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `K` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`HTMLElementDeprecatedTagNameMap`\\[`K`\\]\\>\n\n###### Deprecated\n\n###### Inherited from\n\n```ts\nGridHTMLElement.getElementsByTagName\n```\n\n###### Call Signature\n\n```ts\ngetElementsByTagName(qualifiedName): HTMLCollectionOf<Element>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5098\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `string` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`Element`\\>\n\n###### Inherited from\n\n```ts\nGridHTMLElement.getElementsByTagName\n```\n\n##### getElementsByTagNameNS()\n\n###### Call Signature\n\n```ts\ngetElementsByTagNameNS(namespaceURI, localName): HTMLCollectionOf<HTMLElement>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5099\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespaceURI` | `\"http://www.w3.org/1999/xhtml\"` |\n| `localName` | `string` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`HTMLElement`\\>\n\n###### Inherited from\n\n```ts\nGridHTMLElement.getElementsByTagNameNS\n```\n\n###### Call Signature\n\n```ts\ngetElementsByTagNameNS(namespaceURI, localName): HTMLCollectionOf<SVGElement>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5100\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespaceURI` | `\"http://www.w3.org/2000/svg\"` |\n| `localName` | `string` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`SVGElement`\\>\n\n###### Inherited from\n\n```ts\nGridHTMLElement.getElementsByTagNameNS\n```\n\n###### Call Signature\n\n```ts\ngetElementsByTagNameNS(namespaceURI, localName): HTMLCollectionOf<MathMLElement>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5101\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespaceURI` | `\"http://www.w3.org/1998/Math/MathML\"` |\n| `localName` | `string` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`MathMLElement`\\>\n\n###### Inherited from\n\n```ts\nGridHTMLElement.getElementsByTagNameNS\n```\n\n###### Call Signature\n\n```ts\ngetElementsByTagNameNS(namespace, localName): HTMLCollectionOf<Element>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5102\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespace` | `null` \\| `string` |\n| `localName` | `string` |\n\n###### Returns\n\n`HTMLCollectionOf`\\<`Element`\\>\n\n###### Inherited from\n\n```ts\nGridHTMLElement.getElementsByTagNameNS\n```\n\n##### hasAttribute()\n\n```ts\nhasAttribute(qualifiedName): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5104\n\nReturns true if element has an attribute whose qualified name is qualifiedName, and false otherwise.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `string` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.hasAttribute\n```\n\n##### hasAttributeNS()\n\n```ts\nhasAttributeNS(namespace, localName): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5106\n\nReturns true if element has an attribute whose namespace is namespace and local name is localName.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespace` | `null` \\| `string` |\n| `localName` | `string` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.hasAttributeNS\n```\n\n##### hasAttributes()\n\n```ts\nhasAttributes(): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5108\n\nReturns true if element has attributes, and false otherwise.\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.hasAttributes\n```\n\n##### hasPointerCapture()\n\n```ts\nhasPointerCapture(pointerId): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5109\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `pointerId` | `number` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.hasPointerCapture\n```\n\n##### insertAdjacentElement()\n\n```ts\ninsertAdjacentElement(where, element): null | Element;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5110\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `where` | `InsertPosition` |\n| `element` | `Element` |\n\n###### Returns\n\n`null` \\| `Element`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.insertAdjacentElement\n```\n\n##### insertAdjacentHTML()\n\n```ts\ninsertAdjacentHTML(position, text): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5111\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `position` | `InsertPosition` |\n| `text` | `string` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.insertAdjacentHTML\n```\n\n##### insertAdjacentText()\n\n```ts\ninsertAdjacentText(where, data): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5112\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `where` | `InsertPosition` |\n| `data` | `string` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.insertAdjacentText\n```\n\n##### matches()\n\n```ts\nmatches(selectors): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5114\n\nReturns true if matching selectors against element's root yields element, and false otherwise.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `string` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.matches\n```\n\n##### releasePointerCapture()\n\n```ts\nreleasePointerCapture(pointerId): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5115\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `pointerId` | `number` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.releasePointerCapture\n```\n\n##### removeAttribute()\n\n```ts\nremoveAttribute(qualifiedName): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5117\n\nRemoves element's first attribute whose qualified name is qualifiedName.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `string` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.removeAttribute\n```\n\n##### removeAttributeNS()\n\n```ts\nremoveAttributeNS(namespace, localName): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5119\n\nRemoves element's attribute whose namespace is namespace and local name is localName.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespace` | `null` \\| `string` |\n| `localName` | `string` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.removeAttributeNS\n```\n\n##### removeAttributeNode()\n\n```ts\nremoveAttributeNode(attr): Attr;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5120\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `attr` | `Attr` |\n\n###### Returns\n\n`Attr`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.removeAttributeNode\n```\n\n##### requestFullscreen()\n\n```ts\nrequestFullscreen(options?): Promise<void>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5126\n\nDisplays element fullscreen and resolves promise when done.\n\nWhen supplied, options's navigationUI member indicates whether showing navigation UI while in fullscreen is preferred or not. If set to \"show\", navigation simplicity is preferred over screen space, and if set to \"hide\", more screen space is preferred. User agents are always free to honor user preference over the application's. The default value \"auto\" indicates no application preference.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `FullscreenOptions` |\n\n###### Returns\n\n`Promise`\\<`void`\\>\n\n###### Inherited from\n\n```ts\nGridHTMLElement.requestFullscreen\n```\n\n##### requestPointerLock()\n\n```ts\nrequestPointerLock(): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5127\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.requestPointerLock\n```\n\n##### scroll()\n\n###### Call Signature\n\n```ts\nscroll(options?): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5128\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `ScrollToOptions` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.scroll\n```\n\n###### Call Signature\n\n```ts\nscroll(x, y): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5129\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `x` | `number` |\n| `y` | `number` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.scroll\n```\n\n##### scrollBy()\n\n###### Call Signature\n\n```ts\nscrollBy(options?): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5130\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `ScrollToOptions` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.scrollBy\n```\n\n###### Call Signature\n\n```ts\nscrollBy(x, y): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5131\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `x` | `number` |\n| `y` | `number` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.scrollBy\n```\n\n##### scrollIntoView()\n\n```ts\nscrollIntoView(arg?): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5132\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `arg?` | `boolean` \\| `ScrollIntoViewOptions` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.scrollIntoView\n```\n\n##### scrollTo()\n\n###### Call Signature\n\n```ts\nscrollTo(options?): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5133\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `ScrollToOptions` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.scrollTo\n```\n\n###### Call Signature\n\n```ts\nscrollTo(x, y): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5134\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `x` | `number` |\n| `y` | `number` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.scrollTo\n```\n\n##### setAttribute()\n\n```ts\nsetAttribute(qualifiedName, value): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5136\n\nSets the value of element's first attribute whose qualified name is qualifiedName to value.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `string` |\n| `value` | `string` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.setAttribute\n```\n\n##### setAttributeNS()\n\n```ts\nsetAttributeNS(\n   namespace, \n   qualifiedName, \n   value): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5138\n\nSets the value of element's attribute whose namespace is namespace and local name is localName to value.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespace` | `null` \\| `string` |\n| `qualifiedName` | `string` |\n| `value` | `string` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.setAttributeNS\n```\n\n##### setAttributeNode()\n\n```ts\nsetAttributeNode(attr): null | Attr;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5139\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `attr` | `Attr` |\n\n###### Returns\n\n`null` \\| `Attr`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.setAttributeNode\n```\n\n##### setAttributeNodeNS()\n\n```ts\nsetAttributeNodeNS(attr): null | Attr;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5140\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `attr` | `Attr` |\n\n###### Returns\n\n`null` \\| `Attr`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.setAttributeNodeNS\n```\n\n##### setPointerCapture()\n\n```ts\nsetPointerCapture(pointerId): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5141\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `pointerId` | `number` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.setPointerCapture\n```\n\n##### toggleAttribute()\n\n```ts\ntoggleAttribute(qualifiedName, force?): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5147\n\nIf force is not given, \"toggles\" qualifiedName, removing it if it is present and adding it if it is not present. If force is true, adds qualifiedName. If force is false, removes qualifiedName.\n\nReturns true if qualifiedName is now present, and false otherwise.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `qualifiedName` | `string` |\n| `force?` | `boolean` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.toggleAttribute\n```\n\n##### ~~webkitMatchesSelector()~~\n\n```ts\nwebkitMatchesSelector(selectors): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5149\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `string` |\n\n###### Returns\n\n`boolean`\n\n###### Deprecated\n\nThis is a legacy alias of `matches`.\n\n###### Inherited from\n\n```ts\nGridHTMLElement.webkitMatchesSelector\n```\n\n##### dispatchEvent()\n\n```ts\ndispatchEvent(event): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:5344\n\nDispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `event` | `Event` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.dispatchEvent\n```\n\n##### attachInternals()\n\n```ts\nattachInternals(): ElementInternals;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:6573\n\n###### Returns\n\n`ElementInternals`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.attachInternals\n```\n\n##### click()\n\n```ts\nclick(): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:6574\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.click\n```\n\n##### addEventListener()\n\n###### Call Signature\n\n```ts\naddEventListener<K>(\n   type, \n   listener, \n   options?): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:6575\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `HTMLElementEventMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `type` | `K` |\n| `listener` | (`this`, `ev`) => `any` |\n| `options?` | `boolean` \\| `AddEventListenerOptions` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.addEventListener\n```\n\n###### Call Signature\n\n```ts\naddEventListener(\n   type, \n   listener, \n   options?): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:6576\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `type` | `string` |\n| `listener` | `EventListenerOrEventListenerObject` |\n| `options?` | `boolean` \\| `AddEventListenerOptions` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.addEventListener\n```\n\n##### removeEventListener()\n\n###### Call Signature\n\n```ts\nremoveEventListener<K>(\n   type, \n   listener, \n   options?): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:6577\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `HTMLElementEventMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `type` | `K` |\n| `listener` | (`this`, `ev`) => `any` |\n| `options?` | `boolean` \\| `EventListenerOptions` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.removeEventListener\n```\n\n###### Call Signature\n\n```ts\nremoveEventListener(\n   type, \n   listener, \n   options?): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:6578\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `type` | `string` |\n| `listener` | `EventListenerOrEventListenerObject` |\n| `options?` | `boolean` \\| `EventListenerOptions` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.removeEventListener\n```\n\n##### blur()\n\n```ts\nblur(): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:7768\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.blur\n```\n\n##### focus()\n\n```ts\nfocus(options?): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:7769\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `FocusOptions` |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.focus\n```\n\n##### appendChild()\n\n```ts\nappendChild<T>(node): T;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10274\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `T` *extends* `Node`\\<`T`\\> |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `node` | `T` |\n\n###### Returns\n\n`T`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.appendChild\n```\n\n##### cloneNode()\n\n```ts\ncloneNode(deep?): Node;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10276\n\nReturns a copy of node. If deep is true, the copy also includes the node's descendants.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `deep?` | `boolean` |\n\n###### Returns\n\n`Node`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.cloneNode\n```\n\n##### compareDocumentPosition()\n\n```ts\ncompareDocumentPosition(other): number;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10278\n\nReturns a bitmask indicating the position of other relative to node.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `other` | `Node` |\n\n###### Returns\n\n`number`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.compareDocumentPosition\n```\n\n##### contains()\n\n```ts\ncontains(other): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10280\n\nReturns true if other is an inclusive descendant of node, and false otherwise.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `other` | `null` \\| `Node` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.contains\n```\n\n##### getRootNode()\n\n```ts\ngetRootNode(options?): Node;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10282\n\nReturns node's root.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `options?` | `GetRootNodeOptions` |\n\n###### Returns\n\n`Node`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.getRootNode\n```\n\n##### hasChildNodes()\n\n```ts\nhasChildNodes(): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10284\n\nReturns whether node has children.\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.hasChildNodes\n```\n\n##### insertBefore()\n\n```ts\ninsertBefore<T>(node, child): T;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10285\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `T` *extends* `Node`\\<`T`\\> |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `node` | `T` |\n| `child` | `null` \\| `Node` |\n\n###### Returns\n\n`T`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.insertBefore\n```\n\n##### isDefaultNamespace()\n\n```ts\nisDefaultNamespace(namespace): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10286\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespace` | `null` \\| `string` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.isDefaultNamespace\n```\n\n##### isEqualNode()\n\n```ts\nisEqualNode(otherNode): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10288\n\nReturns whether node and otherNode have the same properties.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `otherNode` | `null` \\| `Node` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.isEqualNode\n```\n\n##### isSameNode()\n\n```ts\nisSameNode(otherNode): boolean;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10289\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `otherNode` | `null` \\| `Node` |\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.isSameNode\n```\n\n##### lookupNamespaceURI()\n\n```ts\nlookupNamespaceURI(prefix): null | string;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10290\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `prefix` | `null` \\| `string` |\n\n###### Returns\n\n`null` \\| `string`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.lookupNamespaceURI\n```\n\n##### lookupPrefix()\n\n```ts\nlookupPrefix(namespace): null | string;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10291\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `namespace` | `null` \\| `string` |\n\n###### Returns\n\n`null` \\| `string`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.lookupPrefix\n```\n\n##### normalize()\n\n```ts\nnormalize(): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10293\n\nRemoves empty exclusive Text nodes and concatenates the data of remaining contiguous exclusive Text nodes into the first of their nodes.\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.normalize\n```\n\n##### removeChild()\n\n```ts\nremoveChild<T>(child): T;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10294\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `T` *extends* `Node`\\<`T`\\> |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `child` | `T` |\n\n###### Returns\n\n`T`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.removeChild\n```\n\n##### replaceChild()\n\n```ts\nreplaceChild<T>(node, child): T;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10295\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `T` *extends* `Node`\\<`T`\\> |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `node` | `Node` |\n| `child` | `T` |\n\n###### Returns\n\n`T`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.replaceChild\n```\n\n##### append()\n\n```ts\nappend(...nodes): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10697\n\nInserts nodes after the last child of node, while replacing strings in nodes with equivalent Text nodes.\n\nThrows a \"HierarchyRequestError\" DOMException if the constraints of the node tree are violated.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| ...`nodes` | (`string` \\| `Node`)[] |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.append\n```\n\n##### prepend()\n\n```ts\nprepend(...nodes): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10703\n\nInserts nodes before the first child of node, while replacing strings in nodes with equivalent Text nodes.\n\nThrows a \"HierarchyRequestError\" DOMException if the constraints of the node tree are violated.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| ...`nodes` | (`string` \\| `Node`)[] |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.prepend\n```\n\n##### querySelector()\n\n###### Call Signature\n\n```ts\nquerySelector<K>(selectors): null | HTMLElementTagNameMap[K];\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10705\n\nReturns the first element that is a descendant of node that matches selectors.\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `HTMLElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `K` |\n\n###### Returns\n\n`null` \\| `HTMLElementTagNameMap`\\[`K`\\]\n\n###### Inherited from\n\n```ts\nGridHTMLElement.querySelector\n```\n\n###### Call Signature\n\n```ts\nquerySelector<K>(selectors): null | SVGElementTagNameMap[K];\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10706\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `SVGElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `K` |\n\n###### Returns\n\n`null` \\| `SVGElementTagNameMap`\\[`K`\\]\n\n###### Inherited from\n\n```ts\nGridHTMLElement.querySelector\n```\n\n###### Call Signature\n\n```ts\nquerySelector<K>(selectors): null | MathMLElementTagNameMap[K];\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10707\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `MathMLElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `K` |\n\n###### Returns\n\n`null` \\| `MathMLElementTagNameMap`\\[`K`\\]\n\n###### Inherited from\n\n```ts\nGridHTMLElement.querySelector\n```\n\n###### Call Signature\n\n```ts\nquerySelector<K>(selectors): null | HTMLElementDeprecatedTagNameMap[K];\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10709\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `HTMLElementDeprecatedTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `K` |\n\n###### Returns\n\n`null` \\| `HTMLElementDeprecatedTagNameMap`\\[`K`\\]\n\n###### Deprecated\n\n###### Inherited from\n\n```ts\nGridHTMLElement.querySelector\n```\n\n###### Call Signature\n\n```ts\nquerySelector<E>(selectors): null | E;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10710\n\n###### Type Parameters\n\n| Type Parameter | Default type |\n| ------ | ------ |\n| `E` *extends* `Element`\\<`E`\\> | `Element` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `string` |\n\n###### Returns\n\n`null` \\| `E`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.querySelector\n```\n\n##### querySelectorAll()\n\n###### Call Signature\n\n```ts\nquerySelectorAll<K>(selectors): NodeListOf<HTMLElementTagNameMap[K]>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10712\n\nReturns all element descendants of node that match selectors.\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `HTMLElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `K` |\n\n###### Returns\n\n`NodeListOf`\\<`HTMLElementTagNameMap`\\[`K`\\]\\>\n\n###### Inherited from\n\n```ts\nGridHTMLElement.querySelectorAll\n```\n\n###### Call Signature\n\n```ts\nquerySelectorAll<K>(selectors): NodeListOf<SVGElementTagNameMap[K]>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10713\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `SVGElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `K` |\n\n###### Returns\n\n`NodeListOf`\\<`SVGElementTagNameMap`\\[`K`\\]\\>\n\n###### Inherited from\n\n```ts\nGridHTMLElement.querySelectorAll\n```\n\n###### Call Signature\n\n```ts\nquerySelectorAll<K>(selectors): NodeListOf<MathMLElementTagNameMap[K]>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10714\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `MathMLElementTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `K` |\n\n###### Returns\n\n`NodeListOf`\\<`MathMLElementTagNameMap`\\[`K`\\]\\>\n\n###### Inherited from\n\n```ts\nGridHTMLElement.querySelectorAll\n```\n\n###### Call Signature\n\n```ts\nquerySelectorAll<K>(selectors): NodeListOf<HTMLElementDeprecatedTagNameMap[K]>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10716\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `K` *extends* keyof `HTMLElementDeprecatedTagNameMap` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `K` |\n\n###### Returns\n\n`NodeListOf`\\<`HTMLElementDeprecatedTagNameMap`\\[`K`\\]\\>\n\n###### Deprecated\n\n###### Inherited from\n\n```ts\nGridHTMLElement.querySelectorAll\n```\n\n###### Call Signature\n\n```ts\nquerySelectorAll<E>(selectors): NodeListOf<E>;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10717\n\n###### Type Parameters\n\n| Type Parameter | Default type |\n| ------ | ------ |\n| `E` *extends* `Element`\\<`E`\\> | `Element` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selectors` | `string` |\n\n###### Returns\n\n`NodeListOf`\\<`E`\\>\n\n###### Inherited from\n\n```ts\nGridHTMLElement.querySelectorAll\n```\n\n##### replaceChildren()\n\n```ts\nreplaceChildren(...nodes): void;\n```\n\nDefined in: node\\_modules/typescript/lib/lib.dom.d.ts:10723\n\nReplace all children of node with nodes, while replacing strings in nodes with equivalent Text nodes.\n\nThrows a \"HierarchyRequestError\" DOMException if the constraints of the node tree are violated.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| ...`nodes` | (`string` \\| `Node`)[] |\n\n###### Returns\n\n`void`\n\n###### Inherited from\n\n```ts\nGridHTMLElement.replaceChildren\n```\n\n#### Properties\n\n| Property | Modifier | Type | Description | Inherited from | Defined in |\n| ------ | ------ | ------ | ------ | ------ | ------ |\n| <a id=\"_gridcomp\"></a> `_gridComp?` | `public` | [`GridstackComponent`](#gridstackcomponent) | Back-reference to the Angular GridStack component | - | [angular/projects/lib/src/lib/gridstack.component.ts:41](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L41) |\n| <a id=\"ariaatomic\"></a> `ariaAtomic` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaAtomic` | node\\_modules/typescript/lib/lib.dom.d.ts:2020 |\n| <a id=\"ariaautocomplete\"></a> `ariaAutoComplete` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaAutoComplete` | node\\_modules/typescript/lib/lib.dom.d.ts:2021 |\n| <a id=\"ariabusy\"></a> `ariaBusy` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaBusy` | node\\_modules/typescript/lib/lib.dom.d.ts:2022 |\n| <a id=\"ariachecked\"></a> `ariaChecked` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaChecked` | node\\_modules/typescript/lib/lib.dom.d.ts:2023 |\n| <a id=\"ariacolcount\"></a> `ariaColCount` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaColCount` | node\\_modules/typescript/lib/lib.dom.d.ts:2024 |\n| <a id=\"ariacolindex\"></a> `ariaColIndex` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaColIndex` | node\\_modules/typescript/lib/lib.dom.d.ts:2025 |\n| <a id=\"ariacolspan\"></a> `ariaColSpan` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaColSpan` | node\\_modules/typescript/lib/lib.dom.d.ts:2026 |\n| <a id=\"ariacurrent\"></a> `ariaCurrent` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaCurrent` | node\\_modules/typescript/lib/lib.dom.d.ts:2027 |\n| <a id=\"ariadisabled\"></a> `ariaDisabled` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaDisabled` | node\\_modules/typescript/lib/lib.dom.d.ts:2028 |\n| <a id=\"ariaexpanded\"></a> `ariaExpanded` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaExpanded` | node\\_modules/typescript/lib/lib.dom.d.ts:2029 |\n| <a id=\"ariahaspopup\"></a> `ariaHasPopup` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaHasPopup` | node\\_modules/typescript/lib/lib.dom.d.ts:2030 |\n| <a id=\"ariahidden\"></a> `ariaHidden` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaHidden` | node\\_modules/typescript/lib/lib.dom.d.ts:2031 |\n| <a id=\"ariainvalid\"></a> `ariaInvalid` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaInvalid` | node\\_modules/typescript/lib/lib.dom.d.ts:2032 |\n| <a id=\"ariakeyshortcuts\"></a> `ariaKeyShortcuts` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaKeyShortcuts` | node\\_modules/typescript/lib/lib.dom.d.ts:2033 |\n| <a id=\"arialabel\"></a> `ariaLabel` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaLabel` | node\\_modules/typescript/lib/lib.dom.d.ts:2034 |\n| <a id=\"arialevel\"></a> `ariaLevel` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaLevel` | node\\_modules/typescript/lib/lib.dom.d.ts:2035 |\n| <a id=\"arialive\"></a> `ariaLive` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaLive` | node\\_modules/typescript/lib/lib.dom.d.ts:2036 |\n| <a id=\"ariamodal\"></a> `ariaModal` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaModal` | node\\_modules/typescript/lib/lib.dom.d.ts:2037 |\n| <a id=\"ariamultiline\"></a> `ariaMultiLine` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaMultiLine` | node\\_modules/typescript/lib/lib.dom.d.ts:2038 |\n| <a id=\"ariamultiselectable\"></a> `ariaMultiSelectable` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaMultiSelectable` | node\\_modules/typescript/lib/lib.dom.d.ts:2039 |\n| <a id=\"ariaorientation\"></a> `ariaOrientation` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaOrientation` | node\\_modules/typescript/lib/lib.dom.d.ts:2040 |\n| <a id=\"ariaplaceholder\"></a> `ariaPlaceholder` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaPlaceholder` | node\\_modules/typescript/lib/lib.dom.d.ts:2041 |\n| <a id=\"ariaposinset\"></a> `ariaPosInSet` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaPosInSet` | node\\_modules/typescript/lib/lib.dom.d.ts:2042 |\n| <a id=\"ariapressed\"></a> `ariaPressed` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaPressed` | node\\_modules/typescript/lib/lib.dom.d.ts:2043 |\n| <a id=\"ariareadonly\"></a> `ariaReadOnly` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaReadOnly` | node\\_modules/typescript/lib/lib.dom.d.ts:2044 |\n| <a id=\"ariarequired\"></a> `ariaRequired` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaRequired` | node\\_modules/typescript/lib/lib.dom.d.ts:2045 |\n| <a id=\"ariaroledescription\"></a> `ariaRoleDescription` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaRoleDescription` | node\\_modules/typescript/lib/lib.dom.d.ts:2046 |\n| <a id=\"ariarowcount\"></a> `ariaRowCount` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaRowCount` | node\\_modules/typescript/lib/lib.dom.d.ts:2047 |\n| <a id=\"ariarowindex\"></a> `ariaRowIndex` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaRowIndex` | node\\_modules/typescript/lib/lib.dom.d.ts:2048 |\n| <a id=\"ariarowspan\"></a> `ariaRowSpan` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaRowSpan` | node\\_modules/typescript/lib/lib.dom.d.ts:2049 |\n| <a id=\"ariaselected\"></a> `ariaSelected` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaSelected` | node\\_modules/typescript/lib/lib.dom.d.ts:2050 |\n| <a id=\"ariasetsize\"></a> `ariaSetSize` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaSetSize` | node\\_modules/typescript/lib/lib.dom.d.ts:2051 |\n| <a id=\"ariasort\"></a> `ariaSort` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaSort` | node\\_modules/typescript/lib/lib.dom.d.ts:2052 |\n| <a id=\"ariavaluemax\"></a> `ariaValueMax` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaValueMax` | node\\_modules/typescript/lib/lib.dom.d.ts:2053 |\n| <a id=\"ariavaluemin\"></a> `ariaValueMin` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaValueMin` | node\\_modules/typescript/lib/lib.dom.d.ts:2054 |\n| <a id=\"ariavaluenow\"></a> `ariaValueNow` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaValueNow` | node\\_modules/typescript/lib/lib.dom.d.ts:2055 |\n| <a id=\"ariavaluetext\"></a> `ariaValueText` | `public` | `null` \\| `string` | - | `GridHTMLElement.ariaValueText` | node\\_modules/typescript/lib/lib.dom.d.ts:2056 |\n| <a id=\"role\"></a> `role` | `public` | `null` \\| `string` | - | `GridHTMLElement.role` | node\\_modules/typescript/lib/lib.dom.d.ts:2057 |\n| <a id=\"attributes\"></a> `attributes` | `readonly` | `NamedNodeMap` | - | `GridHTMLElement.attributes` | node\\_modules/typescript/lib/lib.dom.d.ts:5041 |\n| <a id=\"classlist\"></a> `classList` | `readonly` | `DOMTokenList` | Allows for manipulation of element's class content attribute as a set of whitespace-separated tokens through a DOMTokenList object. | `GridHTMLElement.classList` | node\\_modules/typescript/lib/lib.dom.d.ts:5043 |\n| <a id=\"classname\"></a> `className` | `public` | `string` | Returns the value of element's class content attribute. Can be set to change it. | `GridHTMLElement.className` | node\\_modules/typescript/lib/lib.dom.d.ts:5045 |\n| <a id=\"clientheight\"></a> `clientHeight` | `readonly` | `number` | - | `GridHTMLElement.clientHeight` | node\\_modules/typescript/lib/lib.dom.d.ts:5046 |\n| <a id=\"clientleft\"></a> `clientLeft` | `readonly` | `number` | - | `GridHTMLElement.clientLeft` | node\\_modules/typescript/lib/lib.dom.d.ts:5047 |\n| <a id=\"clienttop\"></a> `clientTop` | `readonly` | `number` | - | `GridHTMLElement.clientTop` | node\\_modules/typescript/lib/lib.dom.d.ts:5048 |\n| <a id=\"clientwidth\"></a> `clientWidth` | `readonly` | `number` | - | `GridHTMLElement.clientWidth` | node\\_modules/typescript/lib/lib.dom.d.ts:5049 |\n| <a id=\"id\"></a> `id` | `public` | `string` | Returns the value of element's id content attribute. Can be set to change it. | `GridHTMLElement.id` | node\\_modules/typescript/lib/lib.dom.d.ts:5051 |\n| <a id=\"localname\"></a> `localName` | `readonly` | `string` | Returns the local name. | `GridHTMLElement.localName` | node\\_modules/typescript/lib/lib.dom.d.ts:5053 |\n| <a id=\"namespaceuri\"></a> `namespaceURI` | `readonly` | `null` \\| `string` | Returns the namespace. | `GridHTMLElement.namespaceURI` | node\\_modules/typescript/lib/lib.dom.d.ts:5055 |\n| <a id=\"onfullscreenchange\"></a> `onfullscreenchange` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onfullscreenchange` | node\\_modules/typescript/lib/lib.dom.d.ts:5056 |\n| <a id=\"onfullscreenerror\"></a> `onfullscreenerror` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onfullscreenerror` | node\\_modules/typescript/lib/lib.dom.d.ts:5057 |\n| <a id=\"outerhtml\"></a> `outerHTML` | `public` | `string` | - | `GridHTMLElement.outerHTML` | node\\_modules/typescript/lib/lib.dom.d.ts:5058 |\n| <a id=\"ownerdocument\"></a> `ownerDocument` | `readonly` | `Document` | Returns the node document. Returns null for documents. | `GridHTMLElement.ownerDocument` | node\\_modules/typescript/lib/lib.dom.d.ts:5059 |\n| <a id=\"part\"></a> `part` | `readonly` | `DOMTokenList` | - | `GridHTMLElement.part` | node\\_modules/typescript/lib/lib.dom.d.ts:5060 |\n| <a id=\"prefix\"></a> `prefix` | `readonly` | `null` \\| `string` | Returns the namespace prefix. | `GridHTMLElement.prefix` | node\\_modules/typescript/lib/lib.dom.d.ts:5062 |\n| <a id=\"scrollheight\"></a> `scrollHeight` | `readonly` | `number` | - | `GridHTMLElement.scrollHeight` | node\\_modules/typescript/lib/lib.dom.d.ts:5063 |\n| <a id=\"scrollleft\"></a> `scrollLeft` | `public` | `number` | - | `GridHTMLElement.scrollLeft` | node\\_modules/typescript/lib/lib.dom.d.ts:5064 |\n| <a id=\"scrolltop\"></a> `scrollTop` | `public` | `number` | - | `GridHTMLElement.scrollTop` | node\\_modules/typescript/lib/lib.dom.d.ts:5065 |\n| <a id=\"scrollwidth\"></a> `scrollWidth` | `readonly` | `number` | - | `GridHTMLElement.scrollWidth` | node\\_modules/typescript/lib/lib.dom.d.ts:5066 |\n| <a id=\"shadowroot\"></a> `shadowRoot` | `readonly` | `null` \\| `ShadowRoot` | Returns element's shadow root, if any, and if shadow root's mode is \"open\", and null otherwise. | `GridHTMLElement.shadowRoot` | node\\_modules/typescript/lib/lib.dom.d.ts:5068 |\n| <a id=\"slot\"></a> `slot` | `public` | `string` | Returns the value of element's slot content attribute. Can be set to change it. | `GridHTMLElement.slot` | node\\_modules/typescript/lib/lib.dom.d.ts:5070 |\n| <a id=\"tagname\"></a> `tagName` | `readonly` | `string` | Returns the HTML-uppercased qualified name. | `GridHTMLElement.tagName` | node\\_modules/typescript/lib/lib.dom.d.ts:5072 |\n| <a id=\"style\"></a> `style` | `readonly` | `CSSStyleDeclaration` | - | `GridHTMLElement.style` | node\\_modules/typescript/lib/lib.dom.d.ts:5162 |\n| <a id=\"contenteditable\"></a> `contentEditable` | `public` | `string` | - | `GridHTMLElement.contentEditable` | node\\_modules/typescript/lib/lib.dom.d.ts:5166 |\n| <a id=\"enterkeyhint\"></a> `enterKeyHint` | `public` | `string` | - | `GridHTMLElement.enterKeyHint` | node\\_modules/typescript/lib/lib.dom.d.ts:5167 |\n| <a id=\"inputmode\"></a> `inputMode` | `public` | `string` | - | `GridHTMLElement.inputMode` | node\\_modules/typescript/lib/lib.dom.d.ts:5168 |\n| <a id=\"iscontenteditable\"></a> `isContentEditable` | `readonly` | `boolean` | - | `GridHTMLElement.isContentEditable` | node\\_modules/typescript/lib/lib.dom.d.ts:5169 |\n| <a id=\"onabort\"></a> `onabort` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user aborts the download. **Param** The event. | `GridHTMLElement.onabort` | node\\_modules/typescript/lib/lib.dom.d.ts:5856 |\n| <a id=\"onanimationcancel\"></a> `onanimationcancel` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onanimationcancel` | node\\_modules/typescript/lib/lib.dom.d.ts:5857 |\n| <a id=\"onanimationend\"></a> `onanimationend` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onanimationend` | node\\_modules/typescript/lib/lib.dom.d.ts:5858 |\n| <a id=\"onanimationiteration\"></a> `onanimationiteration` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onanimationiteration` | node\\_modules/typescript/lib/lib.dom.d.ts:5859 |\n| <a id=\"onanimationstart\"></a> `onanimationstart` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onanimationstart` | node\\_modules/typescript/lib/lib.dom.d.ts:5860 |\n| <a id=\"onauxclick\"></a> `onauxclick` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onauxclick` | node\\_modules/typescript/lib/lib.dom.d.ts:5861 |\n| <a id=\"onbeforeinput\"></a> `onbeforeinput` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onbeforeinput` | node\\_modules/typescript/lib/lib.dom.d.ts:5862 |\n| <a id=\"onblur\"></a> `onblur` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the object loses the input focus. **Param** The focus event. | `GridHTMLElement.onblur` | node\\_modules/typescript/lib/lib.dom.d.ts:5867 |\n| <a id=\"oncancel\"></a> `oncancel` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.oncancel` | node\\_modules/typescript/lib/lib.dom.d.ts:5868 |\n| <a id=\"oncanplay\"></a> `oncanplay` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when playback is possible, but would require further buffering. **Param** The event. | `GridHTMLElement.oncanplay` | node\\_modules/typescript/lib/lib.dom.d.ts:5873 |\n| <a id=\"oncanplaythrough\"></a> `oncanplaythrough` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.oncanplaythrough` | node\\_modules/typescript/lib/lib.dom.d.ts:5874 |\n| <a id=\"onchange\"></a> `onchange` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the contents of the object or selection have changed. **Param** The event. | `GridHTMLElement.onchange` | node\\_modules/typescript/lib/lib.dom.d.ts:5879 |\n| <a id=\"onclick\"></a> `onclick` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user clicks the left mouse button on the object **Param** The mouse event. | `GridHTMLElement.onclick` | node\\_modules/typescript/lib/lib.dom.d.ts:5884 |\n| <a id=\"onclose\"></a> `onclose` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onclose` | node\\_modules/typescript/lib/lib.dom.d.ts:5885 |\n| <a id=\"oncontextmenu\"></a> `oncontextmenu` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user clicks the right mouse button in the client area, opening the context menu. **Param** The mouse event. | `GridHTMLElement.oncontextmenu` | node\\_modules/typescript/lib/lib.dom.d.ts:5890 |\n| <a id=\"oncopy\"></a> `oncopy` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.oncopy` | node\\_modules/typescript/lib/lib.dom.d.ts:5891 |\n| <a id=\"oncuechange\"></a> `oncuechange` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.oncuechange` | node\\_modules/typescript/lib/lib.dom.d.ts:5892 |\n| <a id=\"oncut\"></a> `oncut` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.oncut` | node\\_modules/typescript/lib/lib.dom.d.ts:5893 |\n| <a id=\"ondblclick\"></a> `ondblclick` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user double-clicks the object. **Param** The mouse event. | `GridHTMLElement.ondblclick` | node\\_modules/typescript/lib/lib.dom.d.ts:5898 |\n| <a id=\"ondrag\"></a> `ondrag` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires on the source object continuously during a drag operation. **Param** The event. | `GridHTMLElement.ondrag` | node\\_modules/typescript/lib/lib.dom.d.ts:5903 |\n| <a id=\"ondragend\"></a> `ondragend` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires on the source object when the user releases the mouse at the close of a drag operation. **Param** The event. | `GridHTMLElement.ondragend` | node\\_modules/typescript/lib/lib.dom.d.ts:5908 |\n| <a id=\"ondragenter\"></a> `ondragenter` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires on the target element when the user drags the object to a valid drop target. **Param** The drag event. | `GridHTMLElement.ondragenter` | node\\_modules/typescript/lib/lib.dom.d.ts:5913 |\n| <a id=\"ondragleave\"></a> `ondragleave` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. **Param** The drag event. | `GridHTMLElement.ondragleave` | node\\_modules/typescript/lib/lib.dom.d.ts:5918 |\n| <a id=\"ondragover\"></a> `ondragover` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires on the target element continuously while the user drags the object over a valid drop target. **Param** The event. | `GridHTMLElement.ondragover` | node\\_modules/typescript/lib/lib.dom.d.ts:5923 |\n| <a id=\"ondragstart\"></a> `ondragstart` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires on the source object when the user starts to drag a text selection or selected object. **Param** The event. | `GridHTMLElement.ondragstart` | node\\_modules/typescript/lib/lib.dom.d.ts:5928 |\n| <a id=\"ondrop\"></a> `ondrop` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.ondrop` | node\\_modules/typescript/lib/lib.dom.d.ts:5929 |\n| <a id=\"ondurationchange\"></a> `ondurationchange` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the duration attribute is updated. **Param** The event. | `GridHTMLElement.ondurationchange` | node\\_modules/typescript/lib/lib.dom.d.ts:5934 |\n| <a id=\"onemptied\"></a> `onemptied` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the media element is reset to its initial state. **Param** The event. | `GridHTMLElement.onemptied` | node\\_modules/typescript/lib/lib.dom.d.ts:5939 |\n| <a id=\"onended\"></a> `onended` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the end of playback is reached. **Param** The event | `GridHTMLElement.onended` | node\\_modules/typescript/lib/lib.dom.d.ts:5944 |\n| <a id=\"onerror\"></a> `onerror` | `public` | `OnErrorEventHandler` | Fires when an error occurs during object loading. **Param** The event. | `GridHTMLElement.onerror` | node\\_modules/typescript/lib/lib.dom.d.ts:5949 |\n| <a id=\"onfocus\"></a> `onfocus` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the object receives focus. **Param** The event. | `GridHTMLElement.onfocus` | node\\_modules/typescript/lib/lib.dom.d.ts:5954 |\n| <a id=\"onformdata\"></a> `onformdata` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onformdata` | node\\_modules/typescript/lib/lib.dom.d.ts:5955 |\n| <a id=\"ongotpointercapture\"></a> `ongotpointercapture` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.ongotpointercapture` | node\\_modules/typescript/lib/lib.dom.d.ts:5956 |\n| <a id=\"oninput\"></a> `oninput` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.oninput` | node\\_modules/typescript/lib/lib.dom.d.ts:5957 |\n| <a id=\"oninvalid\"></a> `oninvalid` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.oninvalid` | node\\_modules/typescript/lib/lib.dom.d.ts:5958 |\n| <a id=\"onkeydown\"></a> `onkeydown` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user presses a key. **Param** The keyboard event | `GridHTMLElement.onkeydown` | node\\_modules/typescript/lib/lib.dom.d.ts:5963 |\n| <a id=\"onkeypress\"></a> ~~`onkeypress`~~ | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user presses an alphanumeric key. **Param** The event. **Deprecated** | `GridHTMLElement.onkeypress` | node\\_modules/typescript/lib/lib.dom.d.ts:5969 |\n| <a id=\"onkeyup\"></a> `onkeyup` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user releases a key. **Param** The keyboard event | `GridHTMLElement.onkeyup` | node\\_modules/typescript/lib/lib.dom.d.ts:5974 |\n| <a id=\"onload\"></a> `onload` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires immediately after the browser loads the object. **Param** The event. | `GridHTMLElement.onload` | node\\_modules/typescript/lib/lib.dom.d.ts:5979 |\n| <a id=\"onloadeddata\"></a> `onloadeddata` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when media data is loaded at the current playback position. **Param** The event. | `GridHTMLElement.onloadeddata` | node\\_modules/typescript/lib/lib.dom.d.ts:5984 |\n| <a id=\"onloadedmetadata\"></a> `onloadedmetadata` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the duration and dimensions of the media have been determined. **Param** The event. | `GridHTMLElement.onloadedmetadata` | node\\_modules/typescript/lib/lib.dom.d.ts:5989 |\n| <a id=\"onloadstart\"></a> `onloadstart` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when Internet Explorer begins looking for media data. **Param** The event. | `GridHTMLElement.onloadstart` | node\\_modules/typescript/lib/lib.dom.d.ts:5994 |\n| <a id=\"onlostpointercapture\"></a> `onlostpointercapture` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onlostpointercapture` | node\\_modules/typescript/lib/lib.dom.d.ts:5995 |\n| <a id=\"onmousedown\"></a> `onmousedown` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user clicks the object with either mouse button. **Param** The mouse event. | `GridHTMLElement.onmousedown` | node\\_modules/typescript/lib/lib.dom.d.ts:6000 |\n| <a id=\"onmouseenter\"></a> `onmouseenter` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onmouseenter` | node\\_modules/typescript/lib/lib.dom.d.ts:6001 |\n| <a id=\"onmouseleave\"></a> `onmouseleave` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onmouseleave` | node\\_modules/typescript/lib/lib.dom.d.ts:6002 |\n| <a id=\"onmousemove\"></a> `onmousemove` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user moves the mouse over the object. **Param** The mouse event. | `GridHTMLElement.onmousemove` | node\\_modules/typescript/lib/lib.dom.d.ts:6007 |\n| <a id=\"onmouseout\"></a> `onmouseout` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user moves the mouse pointer outside the boundaries of the object. **Param** The mouse event. | `GridHTMLElement.onmouseout` | node\\_modules/typescript/lib/lib.dom.d.ts:6012 |\n| <a id=\"onmouseover\"></a> `onmouseover` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user moves the mouse pointer into the object. **Param** The mouse event. | `GridHTMLElement.onmouseover` | node\\_modules/typescript/lib/lib.dom.d.ts:6017 |\n| <a id=\"onmouseup\"></a> `onmouseup` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user releases a mouse button while the mouse is over the object. **Param** The mouse event. | `GridHTMLElement.onmouseup` | node\\_modules/typescript/lib/lib.dom.d.ts:6022 |\n| <a id=\"onpaste\"></a> `onpaste` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onpaste` | node\\_modules/typescript/lib/lib.dom.d.ts:6023 |\n| <a id=\"onpause\"></a> `onpause` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when playback is paused. **Param** The event. | `GridHTMLElement.onpause` | node\\_modules/typescript/lib/lib.dom.d.ts:6028 |\n| <a id=\"onplay\"></a> `onplay` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the play method is requested. **Param** The event. | `GridHTMLElement.onplay` | node\\_modules/typescript/lib/lib.dom.d.ts:6033 |\n| <a id=\"onplaying\"></a> `onplaying` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the audio or video has started playing. **Param** The event. | `GridHTMLElement.onplaying` | node\\_modules/typescript/lib/lib.dom.d.ts:6038 |\n| <a id=\"onpointercancel\"></a> `onpointercancel` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onpointercancel` | node\\_modules/typescript/lib/lib.dom.d.ts:6039 |\n| <a id=\"onpointerdown\"></a> `onpointerdown` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onpointerdown` | node\\_modules/typescript/lib/lib.dom.d.ts:6040 |\n| <a id=\"onpointerenter\"></a> `onpointerenter` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onpointerenter` | node\\_modules/typescript/lib/lib.dom.d.ts:6041 |\n| <a id=\"onpointerleave\"></a> `onpointerleave` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onpointerleave` | node\\_modules/typescript/lib/lib.dom.d.ts:6042 |\n| <a id=\"onpointermove\"></a> `onpointermove` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onpointermove` | node\\_modules/typescript/lib/lib.dom.d.ts:6043 |\n| <a id=\"onpointerout\"></a> `onpointerout` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onpointerout` | node\\_modules/typescript/lib/lib.dom.d.ts:6044 |\n| <a id=\"onpointerover\"></a> `onpointerover` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onpointerover` | node\\_modules/typescript/lib/lib.dom.d.ts:6045 |\n| <a id=\"onpointerup\"></a> `onpointerup` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onpointerup` | node\\_modules/typescript/lib/lib.dom.d.ts:6046 |\n| <a id=\"onprogress\"></a> `onprogress` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs to indicate progress while downloading media data. **Param** The event. | `GridHTMLElement.onprogress` | node\\_modules/typescript/lib/lib.dom.d.ts:6051 |\n| <a id=\"onratechange\"></a> `onratechange` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the playback rate is increased or decreased. **Param** The event. | `GridHTMLElement.onratechange` | node\\_modules/typescript/lib/lib.dom.d.ts:6056 |\n| <a id=\"onreset\"></a> `onreset` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user resets a form. **Param** The event. | `GridHTMLElement.onreset` | node\\_modules/typescript/lib/lib.dom.d.ts:6061 |\n| <a id=\"onresize\"></a> `onresize` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onresize` | node\\_modules/typescript/lib/lib.dom.d.ts:6062 |\n| <a id=\"onscroll\"></a> `onscroll` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the user repositions the scroll box in the scroll bar on the object. **Param** The event. | `GridHTMLElement.onscroll` | node\\_modules/typescript/lib/lib.dom.d.ts:6067 |\n| <a id=\"onsecuritypolicyviolation\"></a> `onsecuritypolicyviolation` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onsecuritypolicyviolation` | node\\_modules/typescript/lib/lib.dom.d.ts:6068 |\n| <a id=\"onseeked\"></a> `onseeked` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the seek operation ends. **Param** The event. | `GridHTMLElement.onseeked` | node\\_modules/typescript/lib/lib.dom.d.ts:6073 |\n| <a id=\"onseeking\"></a> `onseeking` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the current playback position is moved. **Param** The event. | `GridHTMLElement.onseeking` | node\\_modules/typescript/lib/lib.dom.d.ts:6078 |\n| <a id=\"onselect\"></a> `onselect` | `public` | `null` \\| (`this`, `ev`) => `any` | Fires when the current selection changes. **Param** The event. | `GridHTMLElement.onselect` | node\\_modules/typescript/lib/lib.dom.d.ts:6083 |\n| <a id=\"onselectionchange\"></a> `onselectionchange` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onselectionchange` | node\\_modules/typescript/lib/lib.dom.d.ts:6084 |\n| <a id=\"onselectstart\"></a> `onselectstart` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onselectstart` | node\\_modules/typescript/lib/lib.dom.d.ts:6085 |\n| <a id=\"onslotchange\"></a> `onslotchange` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onslotchange` | node\\_modules/typescript/lib/lib.dom.d.ts:6086 |\n| <a id=\"onstalled\"></a> `onstalled` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the download has stopped. **Param** The event. | `GridHTMLElement.onstalled` | node\\_modules/typescript/lib/lib.dom.d.ts:6091 |\n| <a id=\"onsubmit\"></a> `onsubmit` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onsubmit` | node\\_modules/typescript/lib/lib.dom.d.ts:6092 |\n| <a id=\"onsuspend\"></a> `onsuspend` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs if the load operation has been intentionally halted. **Param** The event. | `GridHTMLElement.onsuspend` | node\\_modules/typescript/lib/lib.dom.d.ts:6097 |\n| <a id=\"ontimeupdate\"></a> `ontimeupdate` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs to indicate the current playback position. **Param** The event. | `GridHTMLElement.ontimeupdate` | node\\_modules/typescript/lib/lib.dom.d.ts:6102 |\n| <a id=\"ontoggle\"></a> `ontoggle` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.ontoggle` | node\\_modules/typescript/lib/lib.dom.d.ts:6103 |\n| <a id=\"ontouchcancel\"></a> `ontouchcancel?` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.ontouchcancel` | node\\_modules/typescript/lib/lib.dom.d.ts:6104 |\n| <a id=\"ontouchend\"></a> `ontouchend?` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.ontouchend` | node\\_modules/typescript/lib/lib.dom.d.ts:6105 |\n| <a id=\"ontouchmove\"></a> `ontouchmove?` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.ontouchmove` | node\\_modules/typescript/lib/lib.dom.d.ts:6106 |\n| <a id=\"ontouchstart\"></a> `ontouchstart?` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.ontouchstart` | node\\_modules/typescript/lib/lib.dom.d.ts:6107 |\n| <a id=\"ontransitioncancel\"></a> `ontransitioncancel` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.ontransitioncancel` | node\\_modules/typescript/lib/lib.dom.d.ts:6108 |\n| <a id=\"ontransitionend\"></a> `ontransitionend` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.ontransitionend` | node\\_modules/typescript/lib/lib.dom.d.ts:6109 |\n| <a id=\"ontransitionrun\"></a> `ontransitionrun` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.ontransitionrun` | node\\_modules/typescript/lib/lib.dom.d.ts:6110 |\n| <a id=\"ontransitionstart\"></a> `ontransitionstart` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.ontransitionstart` | node\\_modules/typescript/lib/lib.dom.d.ts:6111 |\n| <a id=\"onvolumechange\"></a> `onvolumechange` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when the volume is changed, or playback is muted or unmuted. **Param** The event. | `GridHTMLElement.onvolumechange` | node\\_modules/typescript/lib/lib.dom.d.ts:6116 |\n| <a id=\"onwaiting\"></a> `onwaiting` | `public` | `null` \\| (`this`, `ev`) => `any` | Occurs when playback stops because the next frame of a video resource is not available. **Param** The event. | `GridHTMLElement.onwaiting` | node\\_modules/typescript/lib/lib.dom.d.ts:6121 |\n| <a id=\"onwebkitanimationend\"></a> ~~`onwebkitanimationend`~~ | `public` | `null` \\| (`this`, `ev`) => `any` | **Deprecated** This is a legacy alias of `onanimationend`. | `GridHTMLElement.onwebkitanimationend` | node\\_modules/typescript/lib/lib.dom.d.ts:6123 |\n| <a id=\"onwebkitanimationiteration\"></a> ~~`onwebkitanimationiteration`~~ | `public` | `null` \\| (`this`, `ev`) => `any` | **Deprecated** This is a legacy alias of `onanimationiteration`. | `GridHTMLElement.onwebkitanimationiteration` | node\\_modules/typescript/lib/lib.dom.d.ts:6125 |\n| <a id=\"onwebkitanimationstart\"></a> ~~`onwebkitanimationstart`~~ | `public` | `null` \\| (`this`, `ev`) => `any` | **Deprecated** This is a legacy alias of `onanimationstart`. | `GridHTMLElement.onwebkitanimationstart` | node\\_modules/typescript/lib/lib.dom.d.ts:6127 |\n| <a id=\"onwebkittransitionend\"></a> ~~`onwebkittransitionend`~~ | `public` | `null` \\| (`this`, `ev`) => `any` | **Deprecated** This is a legacy alias of `ontransitionend`. | `GridHTMLElement.onwebkittransitionend` | node\\_modules/typescript/lib/lib.dom.d.ts:6129 |\n| <a id=\"onwheel\"></a> `onwheel` | `public` | `null` \\| (`this`, `ev`) => `any` | - | `GridHTMLElement.onwheel` | node\\_modules/typescript/lib/lib.dom.d.ts:6130 |\n| <a id=\"accesskey\"></a> `accessKey` | `public` | `string` | - | `GridHTMLElement.accessKey` | node\\_modules/typescript/lib/lib.dom.d.ts:6555 |\n| <a id=\"accesskeylabel\"></a> `accessKeyLabel` | `readonly` | `string` | - | `GridHTMLElement.accessKeyLabel` | node\\_modules/typescript/lib/lib.dom.d.ts:6556 |\n| <a id=\"autocapitalize\"></a> `autocapitalize` | `public` | `string` | - | `GridHTMLElement.autocapitalize` | node\\_modules/typescript/lib/lib.dom.d.ts:6557 |\n| <a id=\"dir\"></a> `dir` | `public` | `string` | - | `GridHTMLElement.dir` | node\\_modules/typescript/lib/lib.dom.d.ts:6558 |\n| <a id=\"draggable\"></a> `draggable` | `public` | `boolean` | - | `GridHTMLElement.draggable` | node\\_modules/typescript/lib/lib.dom.d.ts:6559 |\n| <a id=\"hidden\"></a> `hidden` | `public` | `boolean` | - | `GridHTMLElement.hidden` | node\\_modules/typescript/lib/lib.dom.d.ts:6560 |\n| <a id=\"inert\"></a> `inert` | `public` | `boolean` | - | `GridHTMLElement.inert` | node\\_modules/typescript/lib/lib.dom.d.ts:6561 |\n| <a id=\"innertext\"></a> `innerText` | `public` | `string` | - | `GridHTMLElement.innerText` | node\\_modules/typescript/lib/lib.dom.d.ts:6562 |\n| <a id=\"lang\"></a> `lang` | `public` | `string` | - | `GridHTMLElement.lang` | node\\_modules/typescript/lib/lib.dom.d.ts:6563 |\n| <a id=\"offsetheight\"></a> `offsetHeight` | `readonly` | `number` | - | `GridHTMLElement.offsetHeight` | node\\_modules/typescript/lib/lib.dom.d.ts:6564 |\n| <a id=\"offsetleft\"></a> `offsetLeft` | `readonly` | `number` | - | `GridHTMLElement.offsetLeft` | node\\_modules/typescript/lib/lib.dom.d.ts:6565 |\n| <a id=\"offsetparent\"></a> `offsetParent` | `readonly` | `null` \\| `Element` | - | `GridHTMLElement.offsetParent` | node\\_modules/typescript/lib/lib.dom.d.ts:6566 |\n| <a id=\"offsettop\"></a> `offsetTop` | `readonly` | `number` | - | `GridHTMLElement.offsetTop` | node\\_modules/typescript/lib/lib.dom.d.ts:6567 |\n| <a id=\"offsetwidth\"></a> `offsetWidth` | `readonly` | `number` | - | `GridHTMLElement.offsetWidth` | node\\_modules/typescript/lib/lib.dom.d.ts:6568 |\n| <a id=\"outertext\"></a> `outerText` | `public` | `string` | - | `GridHTMLElement.outerText` | node\\_modules/typescript/lib/lib.dom.d.ts:6569 |\n| <a id=\"spellcheck\"></a> `spellcheck` | `public` | `boolean` | - | `GridHTMLElement.spellcheck` | node\\_modules/typescript/lib/lib.dom.d.ts:6570 |\n| <a id=\"title\"></a> `title` | `public` | `string` | - | `GridHTMLElement.title` | node\\_modules/typescript/lib/lib.dom.d.ts:6571 |\n| <a id=\"translate\"></a> `translate` | `public` | `boolean` | - | `GridHTMLElement.translate` | node\\_modules/typescript/lib/lib.dom.d.ts:6572 |\n| <a id=\"autofocus\"></a> `autofocus` | `public` | `boolean` | - | `GridHTMLElement.autofocus` | node\\_modules/typescript/lib/lib.dom.d.ts:7764 |\n| <a id=\"dataset\"></a> `dataset` | `readonly` | `DOMStringMap` | - | `GridHTMLElement.dataset` | node\\_modules/typescript/lib/lib.dom.d.ts:7765 |\n| <a id=\"nonce\"></a> `nonce?` | `public` | `string` | - | `GridHTMLElement.nonce` | node\\_modules/typescript/lib/lib.dom.d.ts:7766 |\n| <a id=\"tabindex\"></a> `tabIndex` | `public` | `number` | - | `GridHTMLElement.tabIndex` | node\\_modules/typescript/lib/lib.dom.d.ts:7767 |\n| <a id=\"innerhtml\"></a> `innerHTML` | `public` | `string` | - | `GridHTMLElement.innerHTML` | node\\_modules/typescript/lib/lib.dom.d.ts:9130 |\n| <a id=\"baseuri\"></a> `baseURI` | `readonly` | `string` | Returns node's node document's document base URL. | `GridHTMLElement.baseURI` | node\\_modules/typescript/lib/lib.dom.d.ts:10249 |\n| <a id=\"childnodes\"></a> `childNodes` | `readonly` | `NodeListOf`\\<`ChildNode`\\> | Returns the children. | `GridHTMLElement.childNodes` | node\\_modules/typescript/lib/lib.dom.d.ts:10251 |\n| <a id=\"firstchild\"></a> `firstChild` | `readonly` | `null` \\| `ChildNode` | Returns the first child. | `GridHTMLElement.firstChild` | node\\_modules/typescript/lib/lib.dom.d.ts:10253 |\n| <a id=\"isconnected\"></a> `isConnected` | `readonly` | `boolean` | Returns true if node is connected and false otherwise. | `GridHTMLElement.isConnected` | node\\_modules/typescript/lib/lib.dom.d.ts:10255 |\n| <a id=\"lastchild\"></a> `lastChild` | `readonly` | `null` \\| `ChildNode` | Returns the last child. | `GridHTMLElement.lastChild` | node\\_modules/typescript/lib/lib.dom.d.ts:10257 |\n| <a id=\"nextsibling\"></a> `nextSibling` | `readonly` | `null` \\| `ChildNode` | Returns the next sibling. | `GridHTMLElement.nextSibling` | node\\_modules/typescript/lib/lib.dom.d.ts:10259 |\n| <a id=\"nodename\"></a> `nodeName` | `readonly` | `string` | Returns a string appropriate for the type of node. | `GridHTMLElement.nodeName` | node\\_modules/typescript/lib/lib.dom.d.ts:10261 |\n| <a id=\"nodetype\"></a> `nodeType` | `readonly` | `number` | Returns the type of node. | `GridHTMLElement.nodeType` | node\\_modules/typescript/lib/lib.dom.d.ts:10263 |\n| <a id=\"nodevalue\"></a> `nodeValue` | `public` | `null` \\| `string` | - | `GridHTMLElement.nodeValue` | node\\_modules/typescript/lib/lib.dom.d.ts:10264 |\n| <a id=\"parentelement\"></a> `parentElement` | `readonly` | `null` \\| `HTMLElement` | Returns the parent element. | `GridHTMLElement.parentElement` | node\\_modules/typescript/lib/lib.dom.d.ts:10268 |\n| <a id=\"parentnode\"></a> `parentNode` | `readonly` | `null` \\| `ParentNode` | Returns the parent. | `GridHTMLElement.parentNode` | node\\_modules/typescript/lib/lib.dom.d.ts:10270 |\n| <a id=\"previoussibling\"></a> `previousSibling` | `readonly` | `null` \\| `ChildNode` | Returns the previous sibling. | `GridHTMLElement.previousSibling` | node\\_modules/typescript/lib/lib.dom.d.ts:10272 |\n| <a id=\"textcontent\"></a> `textContent` | `public` | `null` \\| `string` | - | `GridHTMLElement.textContent` | node\\_modules/typescript/lib/lib.dom.d.ts:10273 |\n| <a id=\"element_node\"></a> `ELEMENT_NODE` | `readonly` | `1` | node is an element. | `GridHTMLElement.ELEMENT_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10297 |\n| <a id=\"attribute_node\"></a> `ATTRIBUTE_NODE` | `readonly` | `2` | - | `GridHTMLElement.ATTRIBUTE_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10298 |\n| <a id=\"text_node\"></a> `TEXT_NODE` | `readonly` | `3` | node is a Text node. | `GridHTMLElement.TEXT_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10300 |\n| <a id=\"cdata_section_node\"></a> `CDATA_SECTION_NODE` | `readonly` | `4` | node is a CDATASection node. | `GridHTMLElement.CDATA_SECTION_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10302 |\n| <a id=\"entity_reference_node\"></a> `ENTITY_REFERENCE_NODE` | `readonly` | `5` | - | `GridHTMLElement.ENTITY_REFERENCE_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10303 |\n| <a id=\"entity_node\"></a> `ENTITY_NODE` | `readonly` | `6` | - | `GridHTMLElement.ENTITY_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10304 |\n| <a id=\"processing_instruction_node\"></a> `PROCESSING_INSTRUCTION_NODE` | `readonly` | `7` | node is a ProcessingInstruction node. | `GridHTMLElement.PROCESSING_INSTRUCTION_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10306 |\n| <a id=\"comment_node\"></a> `COMMENT_NODE` | `readonly` | `8` | node is a Comment node. | `GridHTMLElement.COMMENT_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10308 |\n| <a id=\"document_node\"></a> `DOCUMENT_NODE` | `readonly` | `9` | node is a document. | `GridHTMLElement.DOCUMENT_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10310 |\n| <a id=\"document_type_node\"></a> `DOCUMENT_TYPE_NODE` | `readonly` | `10` | node is a doctype. | `GridHTMLElement.DOCUMENT_TYPE_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10312 |\n| <a id=\"document_fragment_node\"></a> `DOCUMENT_FRAGMENT_NODE` | `readonly` | `11` | node is a DocumentFragment node. | `GridHTMLElement.DOCUMENT_FRAGMENT_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10314 |\n| <a id=\"notation_node\"></a> `NOTATION_NODE` | `readonly` | `12` | - | `GridHTMLElement.NOTATION_NODE` | node\\_modules/typescript/lib/lib.dom.d.ts:10315 |\n| <a id=\"document_position_disconnected\"></a> `DOCUMENT_POSITION_DISCONNECTED` | `readonly` | `1` | Set when node and other are not in the same tree. | `GridHTMLElement.DOCUMENT_POSITION_DISCONNECTED` | node\\_modules/typescript/lib/lib.dom.d.ts:10317 |\n| <a id=\"document_position_preceding\"></a> `DOCUMENT_POSITION_PRECEDING` | `readonly` | `2` | Set when other is preceding node. | `GridHTMLElement.DOCUMENT_POSITION_PRECEDING` | node\\_modules/typescript/lib/lib.dom.d.ts:10319 |\n| <a id=\"document_position_following\"></a> `DOCUMENT_POSITION_FOLLOWING` | `readonly` | `4` | Set when other is following node. | `GridHTMLElement.DOCUMENT_POSITION_FOLLOWING` | node\\_modules/typescript/lib/lib.dom.d.ts:10321 |\n| <a id=\"document_position_contains\"></a> `DOCUMENT_POSITION_CONTAINS` | `readonly` | `8` | Set when other is an ancestor of node. | `GridHTMLElement.DOCUMENT_POSITION_CONTAINS` | node\\_modules/typescript/lib/lib.dom.d.ts:10323 |\n| <a id=\"document_position_contained_by\"></a> `DOCUMENT_POSITION_CONTAINED_BY` | `readonly` | `16` | Set when other is a descendant of node. | `GridHTMLElement.DOCUMENT_POSITION_CONTAINED_BY` | node\\_modules/typescript/lib/lib.dom.d.ts:10325 |\n| <a id=\"document_position_implementation_specific\"></a> `DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC` | `readonly` | `32` | - | `GridHTMLElement.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC` | node\\_modules/typescript/lib/lib.dom.d.ts:10326 |\n| <a id=\"nextelementsibling\"></a> `nextElementSibling` | `readonly` | `null` \\| `Element` | Returns the first following sibling that is an element, and null otherwise. | `GridHTMLElement.nextElementSibling` | node\\_modules/typescript/lib/lib.dom.d.ts:10416 |\n| <a id=\"previouselementsibling\"></a> `previousElementSibling` | `readonly` | `null` \\| `Element` | Returns the first preceding sibling that is an element, and null otherwise. | `GridHTMLElement.previousElementSibling` | node\\_modules/typescript/lib/lib.dom.d.ts:10418 |\n| <a id=\"childelementcount\"></a> `childElementCount` | `readonly` | `number` | - | `GridHTMLElement.childElementCount` | node\\_modules/typescript/lib/lib.dom.d.ts:10685 |\n| <a id=\"children\"></a> `children` | `readonly` | `HTMLCollection` | Returns the child elements. | `GridHTMLElement.children` | node\\_modules/typescript/lib/lib.dom.d.ts:10687 |\n| <a id=\"firstelementchild\"></a> `firstElementChild` | `readonly` | `null` \\| `Element` | Returns the first child that is an element, and null otherwise. | `GridHTMLElement.firstElementChild` | node\\_modules/typescript/lib/lib.dom.d.ts:10689 |\n| <a id=\"lastelementchild\"></a> `lastElementChild` | `readonly` | `null` \\| `Element` | Returns the last child that is an element, and null otherwise. | `GridHTMLElement.lastElementChild` | node\\_modules/typescript/lib/lib.dom.d.ts:10691 |\n| <a id=\"assignedslot\"></a> `assignedSlot` | `readonly` | `null` \\| `HTMLSlotElement` | - | `GridHTMLElement.assignedSlot` | node\\_modules/typescript/lib/lib.dom.d.ts:13933 |\n\n## Functions\n\n### gsCreateNgComponents()\n\n```ts\nfunction gsCreateNgComponents(\n   host, \n   n, \n   add, \n   isGrid): undefined | HTMLElement;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:354](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L354)\n\ncan be used when a new item needs to be created, which we do as a Angular component, or deleted (skip)\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `host` | `HTMLElement` \\| [`GridCompHTMLElement`](#gridcomphtmlelement) |\n| `n` | [`NgGridStackNode`](types.md#nggridstacknode) |\n| `add` | `boolean` |\n| `isGrid` | `boolean` |\n\n#### Returns\n\n`undefined` \\| `HTMLElement`\n\n***\n\n### gsSaveAdditionalNgInfo()\n\n```ts\nfunction gsSaveAdditionalNgInfo(n, w): void;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:439](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L439)\n\ncalled for each item in the grid - check if additional information needs to be saved.\nNote: since this is options minus gridstack protected members using Utils.removeInternalForSave(),\nthis typically doesn't need to do anything. However your custom Component @Input() are now supported\nusing BaseWidget.serialize()\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `n` | [`NgGridStackNode`](types.md#nggridstacknode) |\n| `w` | [`NgGridStackWidget`](types.md#nggridstackwidget) |\n\n#### Returns\n\n`void`\n\n***\n\n### gsUpdateNgComponents()\n\n```ts\nfunction gsUpdateNgComponents(n): void;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:458](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L458)\n\ntrack when widgeta re updated (rather than created) to make sure we de-serialize them as well\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `n` | [`NgGridStackNode`](types.md#nggridstacknode) |\n\n#### Returns\n\n`void`\n\n## Type Aliases\n\n### eventCB\n\n```ts\ntype eventCB = object;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:24](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L24)\n\nCallback for general events (enable, disable, etc.)\n\n#### Properties\n\n##### event\n\n```ts\nevent: Event;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:24](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L24)\n\n***\n\n### elementCB\n\n```ts\ntype elementCB = object;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:27](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L27)\n\nCallback for element-specific events (resize, drag, etc.)\n\n#### Properties\n\n##### event\n\n```ts\nevent: Event;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:27](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L27)\n\n##### el\n\n```ts\nel: GridItemHTMLElement;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:27](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L27)\n\n***\n\n### nodesCB\n\n```ts\ntype nodesCB = object;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:30](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L30)\n\nCallback for events affecting multiple nodes (change, etc.)\n\n#### Properties\n\n##### event\n\n```ts\nevent: Event;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:30](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L30)\n\n##### nodes\n\n```ts\nnodes: GridStackNode[];\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:30](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L30)\n\n***\n\n### droppedCB\n\n```ts\ntype droppedCB = object;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:33](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L33)\n\nCallback for drop events with before/after node state\n\n#### Properties\n\n##### event\n\n```ts\nevent: Event;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:33](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L33)\n\n##### previousNode\n\n```ts\npreviousNode: GridStackNode;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:33](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L33)\n\n##### newNode\n\n```ts\nnewNode: GridStackNode;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:33](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L33)\n\n***\n\n### SelectorToType\n\n```ts\ntype SelectorToType = object;\n```\n\nDefined in: [angular/projects/lib/src/lib/gridstack.component.ts:48](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.component.ts#L48)\n\nMapping of selector strings to Angular component types.\nUsed for dynamic component creation based on widget selectors.\n\n#### Index Signature\n\n```ts\n[key: string]: Type<object>\n```\n"
  },
  {
    "path": "angular/doc/api/gridstack.module.md",
    "content": "# gridstack.module\n\n## Classes\n\n### ~~GridstackModule~~\n\nDefined in: [angular/projects/lib/src/lib/gridstack.module.ts:44](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/gridstack.module.ts#L44)\n\n#### Deprecated\n\nUse GridstackComponent and GridstackItemComponent as standalone components instead.\n\nThis NgModule is provided for backward compatibility but is no longer the recommended approach.\r\nImport components directly in your standalone components or use the new Angular module structure.\n\n#### Example\n\n```typescript\r\n// Preferred approach - standalone components\r\n@Component({\r\n  selector: 'my-app',\r\n  imports: [GridstackComponent, GridstackItemComponent],\r\n  template: '<gridstack></gridstack>'\r\n})\r\nexport class AppComponent {}\n\n// Legacy approach (deprecated)\r\n@NgModule({\r\n  imports: [GridstackModule]\r\n})\r\nexport class AppModule {}\r\n```\n\n#### Constructors\n\n##### Constructor\n\n```ts\nnew GridstackModule(): GridstackModule;\n```\n\n###### Returns\n\n[`GridstackModule`](#gridstackmodule)\n"
  },
  {
    "path": "angular/doc/api/index.md",
    "content": "# GridStack Angular Library v12.4.2\n\n## Modules\n\n| Module | Description |\n| ------ | ------ |\n| [gridstack.component](gridstack.component.md) | - |\n| [gridstack-item.component](gridstack-item.component.md) | - |\n| [gridstack.module](gridstack.module.md) | - |\n| [base-widget](base-widget.md) | - |\n| [types](types.md) | - |\n"
  },
  {
    "path": "angular/doc/api/types.md",
    "content": "# types\n\n## Interfaces\n\n### NgGridStackWidget\n\nDefined in: [angular/projects/lib/src/lib/types.ts:12](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/types.ts#L12)\n\nExtended GridStackWidget interface for Angular integration.\r\nAdds Angular-specific properties for dynamic component creation.\n\n#### Extends\n\n- `GridStackWidget`\n\n#### Properties\n\n| Property | Type | Description | Overrides | Defined in |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"selector\"></a> `selector?` | `string` | Angular component selector for dynamic creation (e.g., 'my-widget') | - | [angular/projects/lib/src/lib/types.ts:14](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/types.ts#L14) |\n| <a id=\"input\"></a> `input?` | [`NgCompInputs`](#ngcompinputs) | Serialized data for component @Input() properties | - | [angular/projects/lib/src/lib/types.ts:16](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/types.ts#L16) |\n| <a id=\"subgridopts\"></a> `subGridOpts?` | [`NgGridStackOptions`](#nggridstackoptions) | Configuration for nested sub-grids | `GridStackWidget.subGridOpts` | [angular/projects/lib/src/lib/types.ts:18](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/types.ts#L18) |\n\n***\n\n### NgGridStackNode\n\nDefined in: [angular/projects/lib/src/lib/types.ts:25](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/types.ts#L25)\n\nExtended GridStackNode interface for Angular integration.\r\nAdds component selector for dynamic content creation.\n\n#### Extends\n\n- `GridStackNode`\n\n#### Properties\n\n| Property | Type | Description | Defined in |\n| ------ | ------ | ------ | ------ |\n| <a id=\"selector-1\"></a> `selector?` | `string` | Angular component selector for this node's content | [angular/projects/lib/src/lib/types.ts:27](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/types.ts#L27) |\n\n***\n\n### NgGridStackOptions\n\nDefined in: [angular/projects/lib/src/lib/types.ts:34](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/types.ts#L34)\n\nExtended GridStackOptions interface for Angular integration.\r\nSupports Angular-specific widget definitions and nested grids.\n\n#### Extends\n\n- `GridStackOptions`\n\n#### Properties\n\n| Property | Type | Description | Overrides | Defined in |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"children\"></a> `children?` | [`NgGridStackWidget`](#nggridstackwidget)[] | Array of Angular widget definitions for initial grid setup | `GridStackOptions.children` | [angular/projects/lib/src/lib/types.ts:36](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/types.ts#L36) |\n| <a id=\"subgridopts-1\"></a> `subGridOpts?` | [`NgGridStackOptions`](#nggridstackoptions) | Configuration for nested sub-grids (Angular-aware) | `GridStackOptions.subGridOpts` | [angular/projects/lib/src/lib/types.ts:38](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/types.ts#L38) |\n\n## Type Aliases\n\n### NgCompInputs\n\n```ts\ntype NgCompInputs = object;\n```\n\nDefined in: [angular/projects/lib/src/lib/types.ts:55](https://github.com/adumesny/gridstack.js/blob/master/angular/projects/lib/src/lib/types.ts#L55)\n\nType for component input data serialization.\r\nMaps @Input() property names to their values for widget persistence.\n\n#### Index Signature\n\n```ts\n[key: string]: any\n```\n\n#### Example\n\n```typescript\r\nconst inputs: NgCompInputs = {\r\n  title: 'My Widget',\r\n  value: 42,\r\n  config: { enabled: true }\r\n};\r\n```\n"
  },
  {
    "path": "angular/package.json",
    "content": "{\n  \"name\": \"gridstack-lib\",\n  \"version\": \"0.0.0\",\n  \"scripts\": {\n    \"ng\": \"ng\",\n    \"start\": \"ng serve\",\n    \"build\": \"ng build\",\n    \"watch\": \"ng build --watch --configuration development\",\n    \"test\": \"ng test\",\n    \"doc\": \"npx typedoc --options typedoc.json && npx typedoc --options typedoc.html.json\",\n    \"doc:api\": \"npx typedoc --options typedoc.json\",\n    \"doc:html\": \"npx typedoc --options typedoc.html.json\"\n  },\n  \"private\": true,\n  \"dependencies\": {\n    \"@angular/animations\": \"^14\",\n    \"@angular/common\": \"^14\",\n    \"@angular/compiler\": \"^14\",\n    \"@angular/core\": \"^14\",\n    \"@angular/forms\": \"^14\",\n    \"@angular/platform-browser\": \"^14\",\n    \"@angular/platform-browser-dynamic\": \"^14\",\n    \"@angular/router\": \"^14\",\n    \"gridstack\": \"^12.4.2\",\n    \"rxjs\": \"~7.5.0\",\n    \"tslib\": \"^2.3.0\",\n    \"zone.js\": \"~0.11.4\"\n  },\n  \"devDependencies\": {\n    \"@angular-devkit/build-angular\": \"^14\",\n    \"@angular/cli\": \"^14\",\n    \"@angular/compiler-cli\": \"^14\",\n    \"@types/jasmine\": \"~4.0.0\",\n    \"jasmine-core\": \"~4.3.0\",\n    \"karma\": \"~6.4.0\",\n    \"karma-chrome-launcher\": \"~3.1.0\",\n    \"karma-coverage\": \"~2.2.0\",\n    \"karma-jasmine\": \"~5.1.0\",\n    \"karma-jasmine-html-reporter\": \"~2.0.0\",\n    \"ng-packagr\": \"^14\",\n    \"typescript\": \"~4.7.2\"\n  }\n}\n"
  },
  {
    "path": "angular/projects/demo/.browserslistrc",
    "content": "# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.\n# For additional information regarding the format and rule options, please see:\n# https://github.com/browserslist/browserslist#queries\n\n# For the full list of supported browsers by the Angular framework, please see:\n# https://angular.io/guide/browser-support\n\n# You can see what browsers were selected by your queries by running:\n#   npx browserslist\n\nlast 1 Chrome version\nlast 1 Firefox version\nlast 2 Edge major versions\nlast 2 Safari major versions\nlast 2 iOS major versions\nFirefox ESR\n"
  },
  {
    "path": "angular/projects/demo/karma.conf.js",
    "content": "// Karma configuration file, see link for more information\n// https://karma-runner.github.io/1.0/config/configuration-file.html\n\nmodule.exports = function (config) {\n  config.set({\n    basePath: '',\n    frameworks: ['jasmine', '@angular-devkit/build-angular'],\n    plugins: [\n      require('karma-jasmine'),\n      require('karma-chrome-launcher'),\n      require('karma-jasmine-html-reporter'),\n      require('karma-coverage'),\n      require('@angular-devkit/build-angular/plugins/karma')\n    ],\n    client: {\n      jasmine: {\n        // you can add configuration options for Jasmine here\n        // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html\n        // for example, you can disable the random execution with `random: false`\n        // or set a specific seed with `seed: 4321`\n      },\n      clearContext: false // leave Jasmine Spec Runner output visible in browser\n    },\n    jasmineHtmlReporter: {\n      suppressAll: true // removes the duplicated traces\n    },\n    coverageReporter: {\n      dir: require('path').join(__dirname, '../../coverage/demo'),\n      subdir: '.',\n      reporters: [\n        { type: 'html' },\n        { type: 'text-summary' }\n      ]\n    },\n    reporters: ['progress', 'kjhtml'],\n    port: 9876,\n    colors: true,\n    logLevel: config.LOG_INFO,\n    autoWatch: true,\n    browsers: ['Chrome'],\n    singleRun: false,\n    restartOnFileChange: true\n  });\n};\n"
  },
  {
    "path": "angular/projects/demo/src/app/app.component.css",
    "content": ".test-container {\r\n  margin-top: 30px;\r\n}\r\nbutton.active {\r\n  color: #fff;\r\n  background-color: #007bff;\r\n}\r\n\r\n.text-container {\r\n  display: flex;\r\n}\r\n"
  },
  {
    "path": "angular/projects/demo/src/app/app.component.html",
    "content": "<div class=\"button-container\">\n  <p class=\"pick-info\">Pick a demo to load:</p>\n  <button (click)=\"onShow(0)\" [class.active]=\"show===0\">Simple</button>\n  <button (click)=\"onShow(1)\" [class.active]=\"show===1\">ngFor case</button>\n  <button (click)=\"onShow(2)\" [class.active]=\"show===2\">ngFor custom command</button>\n  <button (click)=\"onShow(3)\" [class.active]=\"show===3\">Component HTML template</button>\n  <button (click)=\"onShow(4)\" [class.active]=\"show===4\">Component ngFor</button>\n  <button (click)=\"onShow(5)\" [class.active]=\"show===5\">Component Dynamic</button>\n  <button (click)=\"onShow(6)\" [class.active]=\"show===6\">Nested Grid</button>\n  <button (click)=\"onShow(7)\" [class.active]=\"show===7\">Two Grids + sidebar</button>\n  <button (click)=\"onShow(8)\" [class.active]=\"show===8\">Lazy Load</button>\n  <button (click)=\"onShow(9)\" [class.active]=\"show===9\">Leak Test</button>\n</div>\n\n<div class=\"test-container\">\n  <angular-simple-test *ngIf=\"show===0\"></angular-simple-test>\n  <angular-ng-for-test *ngIf=\"show===1\"></angular-ng-for-test>\n  <angular-ng-for-cmd-test *ngIf=\"show===2\"></angular-ng-for-cmd-test>\n\n  <div *ngIf=\"show===3\">\n    <p><b>COMPONENT template</b>: using DOM template to use components statically</p>\n    <button (click)=\"add()\">add item</button>\n    <button (click)=\"delete()\">remove item</button>\n    <button (click)=\"modify()\">modify item</button>\n    <button (click)=\"newLayout()\">new layout</button>\n    <gridstack [options]=\"gridOptions\" (changeCB)=\"onChange($event)\" (resizeStopCB)=\"onResizeStop($event)\">\n      <gridstack-item gs-x=\"1\" gs-y=\"0\">item 1</gridstack-item>\n      <gridstack-item gs-x=\"3\" gs-y=\"0\" gs-w=\"2\">item 2 wide</gridstack-item>\n    </gridstack>\n  </div>\n\n  <div *ngIf=\"show===4\">\n    <p><b>COMPONENT ngFor</b>: Most complete example that uses Component wrapper for grid and gridItem</p>\n    <button (click)=\"addNgFor()\">add item</button>\n    <button (click)=\"deleteNgFor()\">remove item</button>\n    <button (click)=\"modifyNgFor()\">modify item</button>\n    <button (click)=\"newLayoutNgFor()\">new layout</button>\n    <gridstack [options]=\"gridOptions\" (changeCB)=\"onChange($event)\" (resizeStopCB)=\"onResizeStop($event)\">\n      <gridstack-item *ngFor=\"let n of items; trackBy: identify\" [options]=\"n\"></gridstack-item>\n    </gridstack>\n  </div>\n\n  <div *ngIf=\"show===5\">\n    <p><b>COMPONENT dynamic</b>: Best example that uses Component wrapper and dynamic grid creation (drag between grids, from toolbar, etc...)</p>\n    <button (click)=\"add()\">add item</button>\n    <button (click)=\"delete()\">remove item</button>\n    <button (click)=\"modify()\">modify item</button>\n    <button (click)=\"newLayout()\">new layout</button>\n    <button (click)=\"saveGrid()\">Save</button>\n    <button (click)=\"clearGrid()\">Clear</button>\n    <button (click)=\"loadGrid()\">Load</button>\n    <gridstack [options]=\"gridOptionsFull\" (changeCB)=\"onChange($event)\" (resizeStopCB)=\"onResizeStop($event)\">\n    </gridstack>\n  </div>\n\n  <div *ngIf=\"show===6\">\n    <p><b>Nested Grid</b>: shows nested component grids, like nested.html demo but with Ng Components</p>\n    <button (click)=\"add()\">add item</button>\n    <button (click)=\"delete()\">remove item</button>\n    <button (click)=\"modify()\">modify item</button>\n    <button (click)=\"newLayout()\">new layout</button>\n    <button (click)=\"saveGrid()\">Save</button>\n    <button (click)=\"clearGrid()\">Clear</button>\n    <button (click)=\"loadGrid()\">Load</button>\n    <!-- add .grid-stack-item for acceptWidgets:true -->\n    <div class=\"sidebar-item grid-stack-item\">Drag nested</div>\n    <div class=\"sidebar-item grid-stack-item\">Comp N nested</div>\n\n    <!-- TODO: addGrid() in code for testing instead ? -->\n    <gridstack [options]=\"nestedGridOptions\" (changeCB)=\"onChange($event)\" (resizeStopCB)=\"onResizeStop($event)\">\n      <div empty-content>Add items here or reload the grid</div>\n    </gridstack>\n  </div>\n\n  <div *ngIf=\"show===7\">\n    <p><b>two.html</b>: shows multiple grids, sidebar creating Components</p>\n    <div class=\"row\">\n      <div class=\"col-md-6\">\n        <div class=\"sidebar\">\n          <div class=\"sidebar-item grid-stack-item\">will be A</div>\n          <div class=\"sidebar-item grid-stack-item\">will be B max=3</div>\n        </div>\n      </div>\n      <div class=\"col-md-6\">\n        <div class=\"trash\" id=\"trash\">\n        </div>\n      </div>\n    </div>\n    <div class=\"row\" style=\"margin-top: 20px\">\n      <div class=\"col-md-6\">\n        <gridstack [options]=\"twoGridOpt1\"></gridstack>\n      </div>\n      <div class=\"col-md-6\">\n        <gridstack [options]=\"twoGridOpt2\"></gridstack>\n      </div>\n    </div>\n  </div>\n\n  <div *ngIf=\"show===8\">\n    <p>open console and scroll to see delay loading of components</p>\n    <div style=\"height: 120px; overflow-y: auto\">\n      <gridstack [options]=\"gridOptionsDelay\"></gridstack>\n    </div>\n  </div>\n\n  <div *ngIf=\"show===9\">\n    <p>load() + clear() to memory leak test between the two</p>\n    <button (click)=\"clearGrid()\">Clear</button>\n    <button (click)=\"load(sub0)\">load</button>\n    <button (click)=\"load(sub2)\">load 2</button>\n    <gridstack [options]=\"gridOptions\"></gridstack>\n    <div class=\"grid-container\"></div>\n\n  </div>\n\n  <div *ngIf=\"show<8\" class=\"text-container\">\n    <textarea #origTextArea cols=\"50\" rows=\"50\" readonly=\"readonly\"></textarea>\n    <textarea #textArea cols=\"50\" rows=\"50\" readonly=\"readonly\"></textarea>\n  </div>\n\n</div>\n"
  },
  {
    "path": "angular/projects/demo/src/app/app.component.spec.ts",
    "content": "import { TestBed } from '@angular/core/testing';\nimport { AppComponent } from './app.component';\n\ndescribe('AppComponent', () => {\n  beforeEach(async () => {\n    await TestBed.configureTestingModule({\n      declarations: [\n        AppComponent\n      ],\n    }).compileComponents();\n  });\n\n  it('should create the app', () => {\n    const fixture = TestBed.createComponent(AppComponent);\n    const app = fixture.componentInstance;\n    expect(app).toBeTruthy();\n  });\n\n  it('should have content', () => {\n    const fixture = TestBed.createComponent(AppComponent);\n    fixture.detectChanges();\n    const compiled = fixture.nativeElement as HTMLElement;\n    expect(compiled.querySelector('.pick-info')?.textContent).toContain('Pick a demo to load');\n  });\n});\n"
  },
  {
    "path": "angular/projects/demo/src/app/app.component.ts",
    "content": "import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';\nimport { GridStack, GridStackOptions, GridStackWidget } from 'gridstack';\nimport { AngularSimpleComponent } from './simple';\nimport { AngularNgForTestComponent } from './ngFor';\nimport { AngularNgForCmdTestComponent } from './ngFor_cmd';\n\n// TEST: local testing of file\n// import { GridstackComponent, NgGridStackOptions, NgGridStackWidget, elementCB, gsCreateNgComponents, nodesCB } from './gridstack.component';\nimport { GridstackComponent, NgGridStackOptions, NgGridStackWidget, elementCB, gsCreateNgComponents, nodesCB } from 'gridstack/dist/angular';\n\n// unique ids sets for each item for correct ngFor updating\nlet ids = 1;\n@Component({\n  selector: 'app-root',\n  templateUrl: './app.component.html',\n  styleUrls: ['./app.component.css']\n})\nexport class AppComponent implements OnInit {\n\n  @ViewChild(AngularSimpleComponent) case0Comp?: AngularSimpleComponent;\n  @ViewChild(AngularNgForTestComponent) case1Comp?: AngularNgForTestComponent;\n  @ViewChild(AngularNgForCmdTestComponent) case2Comp?: AngularNgForCmdTestComponent;\n  @ViewChild(GridstackComponent) gridComp?: GridstackComponent;\n  @ViewChild('origTextArea', {static: true}) origTextEl?: ElementRef<HTMLTextAreaElement>;\n  @ViewChild('textArea', {static: true}) textEl?: ElementRef<HTMLTextAreaElement>;\n\n  // which sample to show\n  public show = 5;\n\n  /** sample grid options and items to load... */\n  public items: GridStackWidget[] = [\n    {x: 0, y: 0, minW: 2},\n    {x: 1, y: 1},\n    {x: 2, y: 2},\n  ];\n  public gridOptions: GridStackOptions = {\n    margin: 5,\n    // float: true,\n    minRow: 1,\n    cellHeight: 70,\n    columnOpts: { breakpoints: [{w:768, c:1}] },\n  }\n  public sub0: NgGridStackWidget[] = [{x:0, y:0, selector:'app-a'}, {x:1, y:0, selector:'app-a', input: {text: 'bar'}}, {x:1, y:1, content:'plain html'}, {x:0, y:1, selector:'app-b'} ];\n  public gridOptionsFull: NgGridStackOptions = {\n    ...this.gridOptions,\n    children: this.sub0,\n  }\n\n  public lazyChildren: NgGridStackWidget[] = [];\n  public gridOptionsDelay: NgGridStackOptions = {\n    ...this.gridOptions,\n    lazyLoad: true,\n    children: this.lazyChildren,\n  }\n\n  // nested grid options\n  private subOptions: GridStackOptions = {\n    cellHeight: 50, // should be 50 - top/bottom\n    column: 'auto', // size to match container\n    acceptWidgets: true, // will accept .grid-stack-item by default\n    margin: 5,\n  };\n  public sub1: NgGridStackWidget[] = [ {x:0, y:0, selector:'app-a'}, {x:1, y:0, selector:'app-b'}, {x:2, y:0, selector:'app-c'}, {x:3, y:0}, {x:0, y:1}, {x:1, y:1}];\n  public sub2: NgGridStackWidget[] = [ {x:0, y:0}, {x:0, y:1, w:2}];\n  public sub3: NgGridStackWidget = { selector: 'app-n', w:2, h:2, subGridOpts: { children: [{selector: 'app-a'}, {selector: 'app-b', y:0, x:1}]}};\n  private subChildren: NgGridStackWidget[] = [\n    {x:0, y:0, content: 'regular item'},\n    {x:1, y:0, w:4, h:4, subGridOpts: {children: this.sub1}},\n    // {x:5, y:0, w:3, h:4, subGridOpts: {children: this.sub2}},\n    this.sub3,\n  ]\n  public nestedGridOptions: NgGridStackOptions = { // main grid options\n    cellHeight: 50,\n    margin: 5,\n    minRow: 2, // don't collapse when empty\n    acceptWidgets: true,\n    subGridOpts: this.subOptions, // all sub grids will default to those\n    children: this.subChildren,\n  };\n  public twoGridOpt1: NgGridStackOptions = {\n    column: 6,\n    cellHeight: 50,\n    margin: 5,\n    minRow: 1, // don't collapse when empty\n    removable: '.trash',\n    acceptWidgets: true,\n    float: true,\n    children: [\n      {x: 0, y: 0, w: 2, h: 2, selector: 'app-a'},\n      {x: 3, y: 1, h: 2, selector: 'app-b'},\n      {x: 4, y: 1},\n      {x: 2, y: 3, w: 3, maxW: 3, id: 'special', content: 'has maxW=3'},\n    ]\n  };\n  public twoGridOpt2: NgGridStackOptions = { ...this.twoGridOpt1, float: false }\n  private serializedData?: NgGridStackOptions;\n\n  // sidebar content to create storing the Widget description to be used on drop\n  public sidebarContent6: NgGridStackWidget[] = [\n    { w:2, h:2, subGridOpts: { children: [{content: 'nest 1'}, {content: 'nest 2'}]}},\n    this.sub3,\n  ];\n  public sidebarContent7: NgGridStackWidget[] = [\n    {selector: 'app-a'},\n    {selector: 'app-b', w:2, maxW: 3},\n  ];\n\n  constructor() {\n    for (let y = 0; y <= 5; y++) this.lazyChildren.push({x:0, y, id:String(y), selector: y%2 ? 'app-b' : 'app-a'});\n\n    // give them content and unique id to make sure we track them during changes below...\n    [...this.items, ...this.subChildren, ...this.sub1, ...this.sub2, ...this.sub0].forEach((w: NgGridStackWidget) => {\n      if (!w.selector && !w.content && !w.subGridOpts) w.content = `item ${ids++}`;\n    });\n  }\n\n  ngOnInit(): void {\n    this.onShow(this.show);\n\n    // TEST\n    // setTimeout(() => {\n    //   if (!this.gridComp) return;\n    //   this.saveGrid();\n    //   // this.clearGrid();\n    //   this.delete();\n    //   this.delete();\n    //   this.loadGrid();\n    //   this.delete();\n    //   this.delete();\n    // }, 500)\n  }\n\n  public onShow(val: number) {\n    this.show = val;\n\n    // set globally our method to create the right widget type\n    if (val < 3) GridStack.addRemoveCB = undefined;\n    else GridStack.addRemoveCB = gsCreateNgComponents;\n\n    // let the switch take affect then load the starting values (since we sometimes save())\n    setTimeout(() => {\n      let data;\n      switch(val) {\n        case 0: data = this.case0Comp?.items; break;\n        case 1: data = this.case1Comp?.items; break;\n        case 2: data = this.case2Comp?.items; break;\n        case 3: data = this.gridComp?.grid?.save(true, true); break;\n        case 4: data = this.items; break;\n        case 5: data = this.gridOptionsFull; break;\n        case 6: data = this.nestedGridOptions;\n          GridStack.setupDragIn('.sidebar-item', undefined, this.sidebarContent6);\n          break;\n        case 7: data = this.twoGridOpt1;\n          GridStack.setupDragIn('.sidebar-item', undefined, this.sidebarContent7);\n          break;\n      }\n      if (this.origTextEl) this.origTextEl.nativeElement.value = JSON.stringify(data, null, '  ');\n    });\n    if (this.textEl) this.textEl.nativeElement.value = '';\n  }\n\n  /** called whenever items change size/position/etc.. */\n  public onChange(data: nodesCB) {\n    // TODO: update our TEMPLATE list to match ?\n    // NOTE: no need for dynamic as we can always use grid.save() to get latest layout, or grid.engine.nodes\n    console.log('change ', data.nodes.length > 1 ? data.nodes : data.nodes[0]);\n  }\n\n  public onResizeStop(data: elementCB) {\n    console.log('resizestop ', data.el.gridstackNode);\n  }\n\n  /**\n   * TEST dynamic grid operations - uses grid API directly (since we don't track structure that gets out of sync)\n   */\n  public add() {\n    // TODO: BUG the content doesn't appear until widget is moved around (or another created). Need to force\n    // angular detection changes...\n    this.gridComp?.grid?.addWidget({x:3, y:0, w:2, content:`item ${ids}`, id:String(ids++)});\n  }\n  public delete() {\n    let grid = this.gridComp?.grid;\n    if (!grid) return;\n    let node = grid.engine.nodes[0];\n    // delete any children first before subGrid itself...\n    if (node?.subGrid && node.subGrid.engine.nodes.length) {\n      grid = node.subGrid;\n      node = grid.engine.nodes[0];\n    }\n    if (node) grid.removeWidget(node.el!);\n  }\n  public modify() {\n    this.gridComp?.grid?.update(this.gridComp?.grid.engine.nodes[0]?.el!, {w:3})\n  }\n  public newLayout() {\n    this.gridComp?.grid?.load([\n      {x:0, y:1, id:'1', minW:1, w:1}, // new size/constrain\n      {x:1, y:1, id:'2'},\n      // {x:2, y:1, id:'3'}, // delete item\n      {x:3, y:0, w:2, content:'new item'}, // new item\n    ]);\n  }\n  public load(layout: GridStackWidget[]) {\n    this.gridComp?.grid?.load(layout);\n  }\n\n  /**\n   * ngFor case: TEST TEMPLATE operations - NOT recommended unless you have no GS creating/re-parenting\n   */\n  public addNgFor() {\n    // new array isn't required as Angular detects changes to content with trackBy:identify()\n    // this.items = [...this.items, { x:3, y:0, w:3, content:`item ${ids}`, id:String(ids++) }];\n    this.items.push({w:2, content:`item ${ids}`, id:String(ids++)});\n  }\n  public deleteNgFor() {\n    this.items.pop();\n  }\n  public modifyNgFor() {\n    // this will not update the DOM nor trigger gridstackItems.changes for GS to auto-update, so set new option of the gridItem instead\n    // this.items[0].w = 3;\n    const gridItem = this.gridComp?.gridstackItems?.get(0);\n    if (gridItem) gridItem.options = {w:3};\n  }\n  public newLayoutNgFor() {\n    this.items = [\n      {x:0, y:1, id:'1', minW:1, w:1}, // new size/constrain\n      {x:1, y:1, id:'2'},\n      // {x:2, y:1, id:'3'}, // delete item\n      {x:3, y:0, w:2, content:'new item'}, // new item\n    ];\n  }\n  public clearGrid() {\n    if (!this.gridComp) return;\n    this.gridComp.grid?.removeAll();\n  }\n  public saveGrid() {\n    this.serializedData = this.gridComp?.grid?.save(false, true) as GridStackOptions || ''; // no content, full options\n    if (this.textEl) this.textEl.nativeElement.value = JSON.stringify(this.serializedData, null, '  ');\n  }\n  public loadGrid() {\n    if (!this.gridComp) return;\n    GridStack.addGrid(this.gridComp.el, this.serializedData);\n  }\n\n  // ngFor TEMPLATE unique node id to have correct match between our items used and GS\n  public identify(index: number, w: GridStackWidget) {\n    return w.id; // or use index if no id is set and you only modify at the end...\n  }\n}\n"
  },
  {
    "path": "angular/projects/demo/src/app/app.config.ts",
    "content": "import { ApplicationConfig, provideEnvironmentInitializer } from '@angular/core';\n\n// TEST local testing\n// import { GridstackComponent } from './gridstack.component';\nimport { GridstackComponent } from 'gridstack/dist/angular';\nimport { AComponent, BComponent, CComponent, NComponent } from './dummy.component';\n\nexport const appConfig: ApplicationConfig = {\n  providers: [\n    provideEnvironmentInitializer(() => {\n      // register all our dynamic components created in the grid\n      GridstackComponent.addComponentToSelectorType([AComponent, BComponent, CComponent, NComponent]);\n    })\n  ]\n};\n"
  },
  {
    "path": "angular/projects/demo/src/app/app.module.ts",
    "content": "import { NgModule } from '@angular/core';\r\nimport { BrowserModule } from '@angular/platform-browser';\r\n\r\nimport { AppComponent } from './app.component';\r\nimport { AngularNgForTestComponent } from './ngFor';\r\nimport { AngularNgForCmdTestComponent } from './ngFor_cmd';\r\nimport { AngularSimpleComponent } from './simple';\r\nimport { AComponent, BComponent, CComponent, NComponent } from './dummy.component';\r\n\r\n// TEST local testing\r\n// import { GridstackModule } from './gridstack.module';\r\n// import { GridstackComponent } from './gridstack.component';\r\nimport { GridstackModule, GridstackComponent } from 'gridstack/dist/angular';\r\n\r\n@NgModule({\r\n  imports: [\r\n    BrowserModule,\r\n    GridstackModule,\r\n  ],\r\n  declarations: [\r\n    AngularNgForCmdTestComponent,\r\n    AngularNgForTestComponent,\r\n    AngularSimpleComponent,\r\n    AppComponent,\r\n    AComponent,\r\n    BComponent,\r\n    CComponent,\r\n    NComponent,\r\n  ],\r\n  exports: [\r\n  ],\r\n  providers: [],\r\n  bootstrap: [AppComponent]\r\n})\r\nexport class AppModule {\r\n  constructor() {\r\n    // register all our dynamic components created in the grid\r\n    GridstackComponent.addComponentToSelectorType([AComponent, BComponent, CComponent, NComponent]);\r\n  }\r\n}\r\n"
  },
  {
    "path": "angular/projects/demo/src/app/dummy.component.ts",
    "content": "/**\n * gridstack.component.ts 8.2.1\n * Copyright (c) 2022-2024 Alain Dumesny - see GridStack root license\n */\n\n// dummy testing component that will be grid items content\n\nimport { Component, OnDestroy, Input, ViewChild, ViewContainerRef } from '@angular/core';\n\n// TEST local testing\n// import { BaseWidget } from './base-widget';\n// import { NgCompInputs } from './gridstack.component';\nimport { BaseWidget, NgCompInputs } from 'gridstack/dist/angular';\n\n@Component({\n  selector: 'app-a',\n  template: 'Comp A {{text}}'\n})\nexport class AComponent extends BaseWidget implements OnDestroy {\n  @Input() text: string = 'foo'; // test custom input data\n  public override serialize(): NgCompInputs | undefined  { return this.text ? {text: this.text} : undefined; }\n  constructor() { super(); console.log('Comp A created'); }\n  ngOnDestroy() { console.log('Comp A destroyed'); } // test to make sure cleanup happens\n}\n\n@Component({\n  selector: 'app-b',\n  template: 'Comp B'\n})\nexport class BComponent extends BaseWidget implements OnDestroy {\n  constructor() { super(); console.log('Comp B created'); }\n  ngOnDestroy() { console.log('Comp B destroyed'); }\n}\n\n@Component({\n  selector: 'app-c',\n  template: 'Comp C'\n})\nexport class CComponent extends BaseWidget implements OnDestroy {\n  ngOnDestroy() { console.log('Comp C destroyed'); }\n}\n\n/** Component that host a sub-grid as a child with controls above/below it. */\n@Component({\n  selector: 'app-n',\n  template: `\n  <div>Comp N</div>\n  <ng-template #container></ng-template>\n  `,\n  /** make the subgrid take entire remaining space even when empty (so you can drag back inside without forcing 1 row) */\n  styles: [`\n    :host { height: 100%; display: flex; flex-direction: column; }\n    ::ng-deep .grid-stack.grid-stack-nested { flex: 1; }\n  `]\n})\nexport class NComponent extends BaseWidget implements OnDestroy {\n  /** this is where the dynamic nested grid will be hosted. gsCreateNgComponents() looks for 'container' like GridstackItemComponent */\n  @ViewChild('container', { read: ViewContainerRef, static: true}) public container?: ViewContainerRef;\n  ngOnDestroy() { console.log('Comp N destroyed'); }\n}\n"
  },
  {
    "path": "angular/projects/demo/src/app/ngFor.ts",
    "content": "/**\r\n * Example using Angular ngFor to loop through items and create DOM items\r\n */\r\n\r\nimport { Component, AfterViewInit, Input, ViewChildren, QueryList, ElementRef } from '@angular/core';\r\nimport { GridItemHTMLElement, GridStack, GridStackNode, GridStackWidget, Utils } from 'gridstack';\r\n\r\n// unique ids sets for each item for correct ngFor updating\r\nlet ids = 1;\r\n\r\n@Component({\r\n  selector: \"angular-ng-for-test\",\r\n  template: `\r\n    <p><b>ngFor</b>: Example using Angular ngFor to loop through items and create DOM items. This track changes made to the array of items, waits for DOM rendering, then update GS</p>\r\n    <button (click)=\"add()\">add item</button>\r\n    <button (click)=\"delete()\">remove item</button>\r\n    <button (click)=\"modify()\">modify item</button>\r\n    <button (click)=\"newLayout()\">new layout</button>\r\n    <div class=\"grid-stack\">\r\n      <!-- using angular templating to create DOM, otherwise an easier way is to simply call grid.load(items)\r\n      NOTE: this example is NOT complete as there are many more properties than listed (minW, maxW, etc....)\r\n      -->\r\n      <div *ngFor=\"let n of items; trackBy: identify\"\r\n        class=\"grid-stack-item\"\r\n        [attr.gs-id]=\"n.id\"\r\n        [attr.gs-x]=\"n.x\"\r\n        [attr.gs-y]=\"n.y\"\r\n        [attr.gs-w]=\"n.w\"\r\n        [attr.gs-h]=\"n.h\"\r\n        #gridStackItem\r\n      >\r\n        <div class=\"grid-stack-item-content\">item {{ n.id }}</div>\r\n      </div>\r\n    </div>\r\n  `,\r\n  // gridstack.min.css and other custom styles should be included in global styles.scss or here\r\n})\r\nexport class AngularNgForTestComponent implements AfterViewInit {\r\n  /** list of HTML items that we track to know when the DOM has been updated to make/remove GS widgets */\r\n  @ViewChildren(\"gridStackItem\") gridstackItems!: QueryList<ElementRef<GridItemHTMLElement>>;\r\n\r\n  /** set the items to display. */\r\n  @Input() public set items(list: GridStackWidget[]) {\r\n    this._items = list || [];\r\n    this._items.forEach(w => w.id = w.id || String(ids++)); // make sure a unique id is generated for correct ngFor loop update\r\n  }\r\n  public get items(): GridStackWidget[] { return this._items}\r\n\r\n  private grid!: GridStack;\r\n  public _items!: GridStackWidget[];\r\n\r\n  constructor() {\r\n    this.items = [\r\n      {x: 0, y: 0},\r\n      {x: 1, y: 1},\r\n      {x: 2, y: 2},\r\n    ];\r\n  }\r\n\r\n  // wait until after DOM is ready to init gridstack - can't be ngOnInit() as angular ngFor needs to run first!\r\n  public ngAfterViewInit() {\r\n    this.grid = GridStack.init({\r\n      margin: 5,\r\n      float: true,\r\n    })\r\n    .on('change added', (event: Event, nodes: GridStackNode[]) => this.onChange(nodes));\r\n\r\n    // sync initial actual valued rendered (in case init() had to merge conflicts)\r\n    this.onChange();\r\n\r\n    /**\r\n     * this is called when the list of items changes - get a list of nodes and\r\n     * update the layout accordingly (which will take care of adding/removing items changed by Angular)\r\n     */\r\n    this.gridstackItems.changes.subscribe(() => {\r\n      const layout: GridStackWidget[] = [];\r\n      this.gridstackItems.forEach(ref => {\r\n        const n = ref.nativeElement.gridstackNode || this.grid.makeWidget(ref.nativeElement).gridstackNode;\r\n        if (n) layout.push(n);\r\n      });\r\n      this.grid.load(layout); // efficient that does diffs only\r\n    })\r\n  }\r\n\r\n  /** Optional: called when given widgets are changed (moved/resized/added) - update our list to match.\r\n   * Note this is not strictly necessary as demo works without this\r\n   */\r\n  public onChange(list = this.grid.engine.nodes) {\r\n    setTimeout(() => // prevent new 'added' items from ExpressionChangedAfterItHasBeenCheckedError. TODO: find cleaner way to sync outside Angular change detection ?\r\n      list.forEach(n => {\r\n        const item = this._items.find(i => i.id === n.id);\r\n        if (item) Utils.copyPos(item, n);\r\n      })\r\n    , 0);\r\n  }\r\n\r\n  /**\r\n   * CRUD operations\r\n   */\r\n  public add() {\r\n    // new array isn't required as Angular seem to detect changes to content\r\n    // this.items = [...this.items, { x:3, y:0, w:3, id:String(ids++) }];\r\n    this.items.push({ x:3, y:0, w:3, id:String(ids++) });\r\n  }\r\n\r\n  public delete() {\r\n    this.items.pop();\r\n  }\r\n\r\n  public modify() {\r\n    // this will only update the DOM attr (from the ngFor loop in our template above)\r\n    // but not trigger gridstackItems.changes for GS to auto-update, so call GS update() instead\r\n    // this.items[0].w = 2;\r\n    const n = this.grid.engine.nodes[0];\r\n    if (n?.el) this.grid.update(n.el, {w:3});\r\n  }\r\n\r\n  public newLayout() {\r\n    this.items = [ // test updating existing and creating new one\r\n      {x:0, y:1, id:'1'},\r\n      {x:1, y:1, id:'2'},\r\n      // {x:2, y:1, id:3}, // delete item\r\n      {x:3, y:0, w:3}, // new item\r\n    ];\r\n  }\r\n\r\n  // ngFor unique node id to have correct match between our items used and GS\r\n  identify(index: number, w: GridStackWidget) {\r\n    return w.id;\r\n  }\r\n}\r\n"
  },
  {
    "path": "angular/projects/demo/src/app/ngFor_cmd.ts",
    "content": "/**\r\n * Example using Angular ngFor to loop through items and create DOM items - this uses a custom command.\r\n * NOTE: see the simpler and better (tracks all changes) angular-ng-for-test\r\n */\r\n\r\nimport { Component, AfterViewInit, Input, ViewChildren, QueryList, ElementRef } from '@angular/core';\r\nimport { Subject, zip } from \"rxjs\";\r\n\r\nimport { GridItemHTMLElement, GridStack, GridStackWidget } from 'gridstack';\r\n\r\n@Component({\r\n  selector: \"angular-ng-for-cmd-test\",\r\n  template: `\r\n    <p><b>ngFor CMD</b>: Example using Angular ngFor to loop through items, but uses an explicity command to let us update GS (see automatic better way)</p>\r\n    <button (click)=\"add()\">add item</button>\r\n    <button (click)=\"delete()\">remove item</button>\r\n    <button (click)=\"modify()\">modify item</button>\r\n    <div class=\"grid-stack\">\r\n      <!-- using angular templating to create DOM, otherwise an easier way is to simply call grid.load(items) -->\r\n      <div\r\n        *ngFor=\"let n of items; let i = index; trackBy: identify\"\r\n        [id]=\"i\"\r\n        class=\"grid-stack-item\"\r\n        [attr.gs-x]=\"n.x\"\r\n        [attr.gs-y]=\"n.y\"\r\n        [attr.gs-w]=\"n.w\"\r\n        [attr.gs-h]=\"n.h\"\r\n        #gridStackItem\r\n      >\r\n        <div class=\"grid-stack-item-content\">item {{ i }}</div>\r\n      </div>\r\n    </div>\r\n  `,\r\n  // gridstack.min.css and other custom styles should be included in global styles.scss or here\r\n})\r\nexport class AngularNgForCmdTestComponent implements AfterViewInit {\r\n  /** list of HTML items that we track to know when the DOM has been updated to make/remove GS widgets */\r\n  @ViewChildren(\"gridStackItem\") gridstackItems!: QueryList<ElementRef<GridItemHTMLElement>>;\r\n\r\n  /** set the items to display. */\r\n  @Input() public items: GridStackWidget[] = [\r\n    {x: 0, y: 0},\r\n    {x: 1, y: 1},\r\n    {x: 2, y: 2},\r\n  ];\r\n\r\n  private grid!: GridStack;\r\n  private widgetToMake: Subject<{\r\n    action: \"add\" | \"remove\" | \"update\";\r\n    id: number;\r\n  }> = new Subject(); // consider to use a state management like ngrx component store to do this\r\n\r\n  constructor() {}\r\n\r\n  // wait until after DOM is ready to init gridstack - can't be ngOnInit() as angular ngFor needs to run first!\r\n  public ngAfterViewInit() {\r\n    this.grid = GridStack.init({\r\n      margin: 5,\r\n      float: true,\r\n    });\r\n\r\n    // To sync dom manipulation done by Angular and widget manipulation done by gridstack we need to zip the observables\r\n    zip(this.gridstackItems.changes, this.widgetToMake).subscribe(\r\n      ([changedWidget, widgetToMake]) => {\r\n        if (widgetToMake.action === \"add\") {\r\n          this.grid.makeWidget(`#${widgetToMake.id}`);\r\n        } else if (widgetToMake.action === \"remove\") {\r\n          const id = String(widgetToMake.id);\r\n          // Note: DOM element has been removed by Angular already so look for it through the engine node list\r\n          const removeEl = this.grid.engine.nodes.find((n) => n.el?.id === id)?.el;\r\n          if (removeEl) this.grid.removeWidget(removeEl);\r\n        }\r\n      }\r\n    );\r\n\r\n    // TODO: the problem with this code is that our items list does NOT reflect changes made by GS (user directly changing,\r\n    // or conflict during initial layout) and believe the other ngFor example (which does track changes) is also cleaner\r\n    // as it doesn't require user creating special action commands nor track 'both' changes using zip().\r\n    // TODO: identify() uses index which is not guaranteed to match between invocations (insert/delete in\r\n    // middle of list instead of end as demo does)\r\n  }\r\n\r\n  /**\r\n   * CRUD operations\r\n   */\r\n  public add() {\r\n    this.items = [...this.items, { x: 3, y: 0, w: 3 }];\r\n    this.widgetToMake.next({ action: \"add\", id: this.items.length - 1 });\r\n  }\r\n\r\n  public delete() {\r\n    this.items.pop();\r\n    this.widgetToMake.next({ action: \"remove\", id: this.items.length });\r\n  }\r\n\r\n  // a change of a widget doesn´t change to amount of items in ngFor therefore we don´t need to do it through the zip function above\r\n  public modify() {\r\n    const updateEl = this.grid.getGridItems().find((el) => el.id === `${0}`);\r\n    this.grid.update(updateEl!, { w: 2 });\r\n  }\r\n\r\n  // ngFor lookup indexing\r\n  identify(index: number) {\r\n    return index;\r\n  }\r\n}\r\n"
  },
  {
    "path": "angular/projects/demo/src/app/simple.ts",
    "content": "/**\r\n * Simplest Angular Example using GridStack API directly\r\n */\r\n import { Component, OnInit } from '@angular/core';\r\n\r\n import { GridStack, GridStackWidget } from 'gridstack';\r\n\r\n @Component({\r\n   selector: 'angular-simple-test',\r\n   template: `\r\n    <p><b>SIMPLEST</b>: angular example using GridStack API directly, so not really using any angular construct per say other than waiting for DOM rendering</p>\r\n     <button (click)=\"add()\">add item</button>\r\n     <button (click)=\"delete()\">remove item</button>\r\n     <button (click)=\"change()\">modify item</button>\r\n     <div class=\"grid-stack\"></div>\r\n     `,\r\n   // gridstack.min.css and other custom styles should be included in global styles.scss\r\n })\r\n export class AngularSimpleComponent implements OnInit {\r\n   public items: GridStackWidget[] = [\r\n     { x: 0, y: 0, w: 9, h: 6, content: '0' },\r\n     { x: 9, y: 0, w: 3, h: 3, content: '1' },\r\n     { x: 9, y: 3, w: 3, h: 3, content: '2' },\r\n   ];\r\n   private grid!: GridStack;\r\n\r\n   constructor() {}\r\n\r\n   // simple div above doesn't require Angular to run, so init gridstack here\r\n   public ngOnInit() {\r\n     this.grid = GridStack.init({\r\n       cellHeight: 70,\r\n     })\r\n     .load(this.items); // and load our content directly (will create DOM)\r\n   }\r\n\r\n   public add() {\r\n     this.grid.addWidget({w: 3, content: 'new content'});\r\n   }\r\n   public delete() {\r\n     this.grid.removeWidget(this.grid.engine.nodes[0].el!);\r\n   }\r\n   public change() {\r\n    this.grid.update(this.grid.engine.nodes[0].el!, {w: 1});\r\n   }\r\n }\r\n"
  },
  {
    "path": "angular/projects/demo/src/assets/.gitkeep",
    "content": ""
  },
  {
    "path": "angular/projects/demo/src/environments/environment.ts",
    "content": "// This file can be replaced during build by using the `fileReplacements` array.\n// `ng build` replaces `environment.ts` with `environment.prod.ts`.\n// The list of file replacements can be found in `angular.json`.\n\nexport const environment = {\n  production: false\n};\n\n/*\n * For easier debugging in development mode, you can import the following file\n * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.\n *\n * This import should be commented out in production mode because it will have a negative impact\n * on performance if an error is thrown.\n */\n// import 'zone.js/plugins/zone-error';  // Included with Angular CLI.\n"
  },
  {
    "path": "angular/projects/demo/src/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <title>Demo</title>\n  <base href=\"/\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <link rel=\"icon\" type=\"image/x-icon\" href=\"favicon.ico\">\n</head>\n<body>\n  <app-root></app-root>\n</body>\n</html>\n"
  },
  {
    "path": "angular/projects/demo/src/main.ts",
    "content": "import { enableProdMode } from '@angular/core';\nimport { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\n\nimport { AppModule } from './app/app.module';\nimport { environment } from './environments/environment';\n\nif (environment.production) {\n  enableProdMode();\n}\n\nplatformBrowserDynamic().bootstrapModule(AppModule)\n  .catch(err => console.error(err));\n"
  },
  {
    "path": "angular/projects/demo/src/polyfills.ts",
    "content": "/**\n * This file includes polyfills needed by Angular and is loaded before the app.\n * You can add your own extra polyfills to this file.\n *\n * This file is divided into 2 sections:\n *   1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.\n *   2. Application imports. Files imported after ZoneJS that should be loaded before your main\n *      file.\n *\n * The current setup is for so-called \"evergreen\" browsers; the last versions of browsers that\n * automatically update themselves. This includes recent versions of Safari, Chrome (including\n * Opera), Edge on the desktop, and iOS and Chrome on mobile.\n *\n * Learn more in https://angular.io/guide/browser-support\n */\n\n/***************************************************************************************************\n * BROWSER POLYFILLS\n */\n\n/**\n * By default, zone.js will patch all possible macroTask and DomEvents\n * user can disable parts of macroTask/DomEvents patch by setting following flags\n * because those flags need to be set before `zone.js` being loaded, and webpack\n * will put import in the top of bundle, so user need to create a separate file\n * in this directory (for example: zone-flags.ts), and put the following flags\n * into that file, and then add the following code before importing zone.js.\n * import './zone-flags';\n *\n * The flags allowed in zone-flags.ts are listed here.\n *\n * The following flags will work for all browsers.\n *\n * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame\n * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick\n * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames\n *\n *  in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js\n *  with the following flag, it will bypass `zone.js` patch for IE/Edge\n *\n *  (window as any).__Zone_enable_cross_context_check = true;\n *\n */\n\n/***************************************************************************************************\n * Zone JS is required by default for Angular itself.\n */\nimport 'zone.js';  // Included with Angular CLI.\n\n\n/***************************************************************************************************\n * APPLICATION IMPORTS\n */\n"
  },
  {
    "path": "angular/projects/demo/src/styles.css",
    "content": "/* Optional styles for demos */\n.btn-primary {\n  color: #fff;\n  background-color: #007bff;\n}\n\n.btn {\n  display: inline-block;\n  padding: .375rem .75rem;\n  line-height: 1.5;\n  border-radius: .25rem;\n}\n\na {\n  text-decoration: none;\n}\n\nh1 {\n  font-size: 2.5rem;\n  margin-bottom: .5rem;\n}\n\n.sidebar {\n  background: rgb(215, 243, 215);\n  padding: 25px 0;\n  height: 100px;\n  text-align: center;\n}\n.sidebar > .grid-stack-item,\n.sidebar-item {\n  width: 120px;\n  height: 50px;\n  border: 2px dashed green;\n  text-align: center;\n  line-height: 35px;\n  background: rgb(192, 231, 192);\n  cursor: default;\n  display: inline-block;\n}\n\n.grid-stack {\n  background: #FAFAD2;\n}\n\n.sidebar > .grid-stack-item,\n.grid-stack-item-content {\n  text-align: center;\n  background-color: #18bc9c;\n}\n\n.grid-stack-item-removing {\n  opacity: 0.5;\n}\n.trash {\n  height: 100px;\n  background: rgba(255, 0, 0, 0.1) center center url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjY0cHgiIGhlaWdodD0iNjRweCIgdmlld0JveD0iMCAwIDQzOC41MjkgNDM4LjUyOSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNDM4LjUyOSA0MzguNTI5OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPGc+CgkJPHBhdGggZD0iTTQxNy42ODksNzUuNjU0Yy0xLjcxMS0xLjcwOS0zLjkwMS0yLjU2OC02LjU2My0yLjU2OGgtODguMjI0TDMwMi45MTcsMjUuNDFjLTIuODU0LTcuMDQ0LTcuOTk0LTEzLjA0LTE1LjQxMy0xNy45ODkgICAgQzI4MC4wNzgsMi40NzMsMjcyLjU1NiwwLDI2NC45NDUsMGgtOTEuMzYzYy03LjYxMSwwLTE1LjEzMSwyLjQ3My0yMi41NTQsNy40MjFjLTcuNDI0LDQuOTQ5LTEyLjU2MywxMC45NDQtMTUuNDE5LDE3Ljk4OSAgICBsLTE5Ljk4NSw0Ny42NzZoLTg4LjIyYy0yLjY2NywwLTQuODUzLDAuODU5LTYuNTY3LDIuNTY4Yy0xLjcwOSwxLjcxMy0yLjU2OCwzLjkwMy0yLjU2OCw2LjU2N3YxOC4yNzQgICAgYzAsMi42NjQsMC44NTUsNC44NTQsMi41NjgsNi41NjRjMS43MTQsMS43MTIsMy45MDQsMi41NjgsNi41NjcsMi41NjhoMjcuNDA2djI3MS44YzAsMTUuODAzLDQuNDczLDI5LjI2NiwxMy40MTgsNDAuMzk4ICAgIGM4Ljk0NywxMS4xMzksMTkuNzAxLDE2LjcwMywzMi4yNjQsMTYuNzAzaDIzNy41NDJjMTIuNTY2LDAsMjMuMzE5LTUuNzU2LDMyLjI2NS0xNy4yNjhjOC45NDUtMTEuNTIsMTMuNDE1LTI1LjE3NCwxMy40MTUtNDAuOTcxICAgIFYxMDkuNjI3aDI3LjQxMWMyLjY2MiwwLDQuODUzLTAuODU2LDYuNTYzLTIuNTY4YzEuNzA4LTEuNzA5LDIuNTctMy45LDIuNTctNi41NjRWODIuMjIxICAgIEM0MjAuMjYsNzkuNTU3LDQxOS4zOTcsNzcuMzY3LDQxNy42ODksNzUuNjU0eiBNMTY5LjMwMSwzOS42NzhjMS4zMzEtMS43MTIsMi45NS0yLjc2Miw0Ljg1My0zLjE0aDkwLjUwNCAgICBjMS45MDMsMC4zODEsMy41MjUsMS40Myw0Ljg1NCwzLjE0bDEzLjcwOSwzMy40MDRIMTU1LjMxMUwxNjkuMzAxLDM5LjY3OHogTTM0Ny4xNzMsMzgwLjI5MWMwLDQuMTg2LTAuNjY0LDguMDQyLTEuOTk5LDExLjU2MSAgICBjLTEuMzM0LDMuNTE4LTIuNzE3LDYuMDg4LTQuMTQxLDcuNzA2Yy0xLjQzMSwxLjYyMi0yLjQyMywyLjQyNy0yLjk5OCwyLjQyN0gxMDAuNDkzYy0wLjU3MSwwLTEuNTY1LTAuODA1LTIuOTk2LTIuNDI3ICAgIGMtMS40MjktMS42MTgtMi44MS00LjE4OC00LjE0My03LjcwNmMtMS4zMzEtMy41MTktMS45OTctNy4zNzktMS45OTctMTEuNTYxVjEwOS42MjdoMjU1LjgxNVYzODAuMjkxeiIgZmlsbD0iI2ZmOWNhZSIvPgoJCTxwYXRoIGQ9Ik0xMzcuMDQsMzQ3LjE3MmgxOC4yNzFjMi42NjcsMCw0Ljg1OC0wLjg1NSw2LjU2Ny0yLjU2N2MxLjcwOS0xLjcxOCwyLjU2OC0zLjkwMSwyLjU2OC02LjU3VjE3My41ODEgICAgYzAtMi42NjMtMC44NTktNC44NTMtMi41NjgtNi41NjdjLTEuNzE0LTEuNzA5LTMuODk5LTIuNTY1LTYuNTY3LTIuNTY1SDEzNy4wNGMtMi42NjcsMC00Ljg1NCwwLjg1NS02LjU2NywyLjU2NSAgICBjLTEuNzExLDEuNzE0LTIuNTY4LDMuOTA0LTIuNTY4LDYuNTY3djE2NC40NTRjMCwyLjY2OSwwLjg1NCw0Ljg1MywyLjU2OCw2LjU3QzEzMi4xODYsMzQ2LjMxNiwxMzQuMzczLDM0Ny4xNzIsMTM3LjA0LDM0Ny4xNzJ6IiBmaWxsPSIjZmY5Y2FlIi8+CgkJPHBhdGggZD0iTTIxMC4xMjksMzQ3LjE3MmgxOC4yNzFjMi42NjYsMCw0Ljg1Ni0wLjg1NSw2LjU2NC0yLjU2N2MxLjcxOC0xLjcxOCwyLjU2OS0zLjkwMSwyLjU2OS02LjU3VjE3My41ODEgICAgYzAtMi42NjMtMC44NTItNC44NTMtMi41NjktNi41NjdjLTEuNzA4LTEuNzA5LTMuODk4LTIuNTY1LTYuNTY0LTIuNTY1aC0xOC4yNzFjLTIuNjY0LDAtNC44NTQsMC44NTUtNi41NjcsMi41NjUgICAgYy0xLjcxNCwxLjcxNC0yLjU2OCwzLjkwNC0yLjU2OCw2LjU2N3YxNjQuNDU0YzAsMi42NjksMC44NTQsNC44NTMsMi41NjgsNi41N0MyMDUuMjc0LDM0Ni4zMTYsMjA3LjQ2NSwzNDcuMTcyLDIxMC4xMjksMzQ3LjE3MnogICAgIiBmaWxsPSIjZmY5Y2FlIi8+CgkJPHBhdGggZD0iTTI4My4yMiwzNDcuMTcyaDE4LjI2OGMyLjY2OSwwLDQuODU5LTAuODU1LDYuNTctMi41NjdjMS43MTEtMS43MTgsMi41NjItMy45MDEsMi41NjItNi41N1YxNzMuNTgxICAgIGMwLTIuNjYzLTAuODUyLTQuODUzLTIuNTYyLTYuNTY3Yy0xLjcxMS0xLjcwOS0zLjkwMS0yLjU2NS02LjU3LTIuNTY1SDI4My4yMmMtMi42NywwLTQuODUzLDAuODU1LTYuNTcxLDIuNTY1ICAgIGMtMS43MTEsMS43MTQtMi41NjYsMy45MDQtMi41NjYsNi41Njd2MTY0LjQ1NGMwLDIuNjY5LDAuODU1LDQuODUzLDIuNTY2LDYuNTdDMjc4LjM2NywzNDYuMzE2LDI4MC41NSwzNDcuMTcyLDI4My4yMiwzNDcuMTcyeiIgZmlsbD0iI2ZmOWNhZSIvPgoJPC9nPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+Cjwvc3ZnPgo=) no-repeat;\n}\n\n/* make nested grid have slightly darker bg take almost all space (need some to tell them apart) so items inside can have similar to external size+margin */\n.grid-stack > .grid-stack-item.grid-stack-sub-grid > .grid-stack-item-content {\n  background: rgba(0,0,0,0.1);\n  inset: 0 2px;\n}\n.grid-stack.grid-stack-nested {\n  background: none;\n}\n.grid-stack-item-content>.grid-stack.grid-stack-nested {\n  /* take entire space */\n  position: absolute;\n  inset: 0; /* TODO change top: if you have content in nested grid */\n}\n\n/* for two.html example from bootstrap.min.css */\n.row {\n  display: -ms-flexbox;\n  display: flex;\n  -ms-flex-wrap: wrap;\n  flex-wrap: wrap;\n  margin-right: -15px;\n  margin-left: -15px;\n  box-sizing: border-box;\n}\n\n.col-md-3 {\n  -ms-flex: 0 0 25%;\n  flex: 0 0 25%;\n  max-width: 25%;\n  box-sizing: border-box;\n}\n\n.col-md-9 {\n  -ms-flex: 0 0 75%;\n  flex: 0 0 75%;\n  max-width: 75%;\n  box-sizing: border-box;\n}\n\n.col-md-6 {\n  -ms-flex: 0 0 50%;\n  flex: 0 0 50%;\n  max-width: 50%;\n  box-sizing: border-box;\n}\n\n.col,\n.col-1,\n.col-10,\n.col-11,\n.col-12,\n.col-2,\n.col-3,\n.col-4,\n.col-5,\n.col-6,\n.col-7,\n.col-8,\n.col-9,\n.col-auto,\n.col-lg,\n.col-lg-1,\n.col-lg-10,\n.col-lg-11,\n.col-lg-12,\n.col-lg-2,\n.col-lg-3,\n.col-lg-4,\n.col-lg-5,\n.col-lg-6,\n.col-lg-7,\n.col-lg-8,\n.col-lg-9,\n.col-lg-auto,\n.col-md,\n.col-md-1,\n.col-md-10,\n.col-md-11,\n.col-md-12,\n.col-md-2,\n.col-md-3,\n.col-md-4,\n.col-md-5,\n.col-md-6,\n.col-md-7,\n.col-md-8,\n.col-md-9,\n.col-md-auto,\n.col-sm,\n.col-sm-1,\n.col-sm-10,\n.col-sm-11,\n.col-sm-12,\n.col-sm-2,\n.col-sm-3,\n.col-sm-4,\n.col-sm-5,\n.col-sm-6,\n.col-sm-7,\n.col-sm-8,\n.col-sm-9,\n.col-sm-auto,\n.col-xl,\n.col-xl-1,\n.col-xl-10,\n.col-xl-11,\n.col-xl-12,\n.col-xl-2,\n.col-xl-3,\n.col-xl-4,\n.col-xl-5,\n.col-xl-6,\n.col-xl-7,\n.col-xl-8,\n.col-xl-9,\n.col-xl-auto {\n  position: relative;\n  width: 100%;\n  padding-right: 15px;\n  padding-left: 15px;\n  box-sizing: border-box;\n}\n"
  },
  {
    "path": "angular/projects/demo/src/test.ts",
    "content": "// This file is required by karma.conf.js and loads recursively all the .spec and framework files\n\nimport 'zone.js/testing';\nimport { getTestBed } from '@angular/core/testing';\nimport {\n  BrowserDynamicTestingModule,\n  platformBrowserDynamicTesting\n} from '@angular/platform-browser-dynamic/testing';\n\ndeclare const require: {\n  context(path: string, deep?: boolean, filter?: RegExp): {\n    <T>(id: string): T;\n    keys(): string[];\n  };\n};\n\n// First, initialize the Angular testing environment.\ngetTestBed().initTestEnvironment(\n  BrowserDynamicTestingModule,\n  platformBrowserDynamicTesting(),\n);\n\n// Then we find all the tests.\nconst context = require.context('./', true, /\\.spec\\.ts$/);\n// And load the modules.\ncontext.keys().forEach(context);\n"
  },
  {
    "path": "angular/projects/demo/tsconfig.app.json",
    "content": "/* To learn more about this file see: https://angular.io/config/tsconfig. */\n{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../../out-tsc/app\",\n    \"types\": []\n  },\n  \"files\": [\n    \"src/main.ts\",\n    \"src/polyfills.ts\"\n  ],\n  \"include\": [\n    \"src/**/*.d.ts\"\n  ]\n}\n"
  },
  {
    "path": "angular/projects/demo/tsconfig.spec.json",
    "content": "/* To learn more about this file see: https://angular.io/config/tsconfig. */\n{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../../out-tsc/spec\",\n    \"types\": [\n      \"jasmine\"\n    ]\n  },\n  \"files\": [\n    \"src/test.ts\",\n    \"src/polyfills.ts\"\n  ],\n  \"include\": [\n    \"src/**/*.spec.ts\",\n    \"src/**/*.d.ts\"\n  ]\n}\n"
  },
  {
    "path": "angular/projects/lib/karma.conf.js",
    "content": "// Karma configuration file, see link for more information\n// https://karma-runner.github.io/1.0/config/configuration-file.html\n\nmodule.exports = function (config) {\n  config.set({\n    basePath: '',\n    frameworks: ['jasmine', '@angular-devkit/build-angular'],\n    plugins: [\n      require('karma-jasmine'),\n      require('karma-chrome-launcher'),\n      require('karma-jasmine-html-reporter'),\n      require('karma-coverage'),\n      require('@angular-devkit/build-angular/plugins/karma')\n    ],\n    client: {\n      jasmine: {\n        // you can add configuration options for Jasmine here\n        // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html\n        // for example, you can disable the random execution with `random: false`\n        // or set a specific seed with `seed: 4321`\n      },\n      clearContext: false // leave Jasmine Spec Runner output visible in browser\n    },\n    jasmineHtmlReporter: {\n      suppressAll: true // removes the duplicated traces\n    },\n    coverageReporter: {\n      dir: require('path').join(__dirname, '../../coverage/lib'),\n      subdir: '.',\n      reporters: [\n        { type: 'html' },\n        { type: 'text-summary' }\n      ]\n    },\n    reporters: ['progress', 'kjhtml'],\n    port: 9876,\n    colors: true,\n    logLevel: config.LOG_INFO,\n    autoWatch: true,\n    browsers: ['Chrome'],\n    singleRun: false,\n    restartOnFileChange: true\n  });\n};\n"
  },
  {
    "path": "angular/projects/lib/ng-package.json",
    "content": "{\n  \"$schema\": \"../../node_modules/ng-packagr/ng-package.schema.json\",\n  \"dest\": \"../../../dist/angular\",\n  \"lib\": {\n    \"entryFile\": \"src/index.ts\"\n  }\n}\n"
  },
  {
    "path": "angular/projects/lib/package.json",
    "content": "{\n  \"name\": \"gridstack-angular\",\n  \"version\": \"12.4.3\",\n  \"peerDependencies\": {\n    \"@angular/common\": \">=14\",\n    \"@angular/core\": \">=14\"\n  },\n  \"dependencies\": {\n    \"tslib\": \"^2.3.0\"\n  }\n}\n"
  },
  {
    "path": "angular/projects/lib/src/index.ts",
    "content": "/*\n * Public API Surface of gridstack-angular\n */\n\nexport * from './lib/types';\nexport * from './lib/base-widget';\nexport * from './lib/gridstack-item.component';\nexport * from './lib/gridstack.component';\nexport * from './lib/gridstack.module';\n"
  },
  {
    "path": "angular/projects/lib/src/lib/base-widget.ts",
    "content": "/**\r\n * gridstack-item.component.ts 12.4.3\r\n * Copyright (c) 2022-2024 Alain Dumesny - see GridStack root license\r\n */\r\n\r\n/**\r\n * Abstract base class that all custom widgets should extend.\r\n *\r\n * This class provides the interface needed for GridstackItemComponent to:\r\n * - Serialize/deserialize widget data\r\n * - Save/restore widget state\r\n * - Integrate with Angular lifecycle\r\n *\r\n * Extend this class when creating custom widgets for dynamic grids.\r\n *\r\n * @example\r\n * ```typescript\r\n * @Component({\r\n *   selector: 'my-custom-widget',\r\n *   template: '<div>{{data}}</div>'\r\n * })\r\n * export class MyCustomWidget extends BaseWidget {\r\n *   @Input() data: string = '';\r\n *\r\n *   serialize() {\r\n *     return { data: this.data };\r\n *   }\r\n * }\r\n * ```\r\n */\r\n\r\nimport { Injectable } from '@angular/core';\r\nimport { NgCompInputs, NgGridStackWidget } from './types';\r\n\r\n/**\r\n * Base widget class for GridStack Angular integration.\r\n */\r\n@Injectable()\r\nexport abstract class BaseWidget {\r\n\r\n  /**\r\n   * Complete widget definition including position, size, and Angular-specific data.\r\n   * Populated automatically when the widget is loaded or saved.\r\n   */\r\n  public widgetItem?: NgGridStackWidget;\r\n\r\n  /**\r\n   * Override this method to return serializable data for this widget.\r\n   *\r\n   * Return an object with properties that map to your component's @Input() fields.\r\n   * The selector is handled automatically, so only include component-specific data.\r\n   *\r\n   * @returns Object containing serializable component data\r\n   *\r\n   * @example\r\n   * ```typescript\r\n   * serialize() {\r\n   *   return {\r\n   *     title: this.title,\r\n   *     value: this.value,\r\n   *     settings: this.settings\r\n   *   };\r\n   * }\r\n   * ```\r\n   */\r\n  public serialize(): NgCompInputs | undefined  { return; }\r\n\r\n  /**\r\n   * Override this method to handle widget restoration from saved data.\r\n   *\r\n   * Use this for complex initialization that goes beyond simple @Input() mapping.\r\n   * The default implementation automatically assigns input data to component properties.\r\n   *\r\n   * @param w The saved widget data including input properties\r\n   *\r\n   * @example\r\n   * ```typescript\r\n   * deserialize(w: NgGridStackWidget) {\r\n   *   super.deserialize(w); // Call parent for basic setup\r\n   *\r\n   *   // Custom initialization logic\r\n   *   if (w.input?.complexData) {\r\n   *     this.processComplexData(w.input.complexData);\r\n   *   }\r\n   * }\r\n   * ```\r\n   */\r\n  public deserialize(w: NgGridStackWidget)  {\r\n    // save full description for meta data\r\n    this.widgetItem = w;\r\n    if (!w) return;\r\n\r\n    if (w.input)  Object.assign(this, w.input);\r\n  }\r\n}\r\n"
  },
  {
    "path": "angular/projects/lib/src/lib/gridstack-item.component.ts",
    "content": "/**\n * gridstack-item.component.ts 12.4.3\n * Copyright (c) 2022-2024 Alain Dumesny - see GridStack root license\n */\n\nimport { Component, ElementRef, Input, ViewChild, ViewContainerRef, OnDestroy, ComponentRef } from '@angular/core';\nimport { GridItemHTMLElement, GridStackNode } from 'gridstack';\nimport { BaseWidget } from './base-widget';\n\n/**\n * Extended HTMLElement interface for grid items.\n * Stores a back-reference to the Angular component for integration.\n */\nexport interface GridItemCompHTMLElement extends GridItemHTMLElement {\n  /** Back-reference to the Angular GridStackItem component */\n  _gridItemComp?: GridstackItemComponent;\n}\n\n/**\n * Angular component wrapper for individual GridStack items.\n *\n * This component represents a single grid item and handles:\n * - Dynamic content creation and management\n * - Integration with parent GridStack component\n * - Component lifecycle and cleanup\n * - Widget options and configuration\n *\n * Use in combination with GridstackComponent for the parent grid.\n *\n * @example\n * ```html\n * <gridstack>\n *   <gridstack-item [options]=\"{x: 0, y: 0, w: 2, h: 1}\">\n *     <my-widget-component></my-widget-component>\n *   </gridstack-item>\n * </gridstack>\n * ```\n */\n@Component({\n  selector: 'gridstack-item',\n  template: `\n    <div class=\"grid-stack-item-content\">\n      <!-- where dynamic items go based on component selector (recommended way), or sub-grids, etc...) -->\n      <ng-template #container></ng-template>\n      <!-- any static (defined in DOM - not recommended) content goes here -->\n      <ng-content></ng-content>\n      <!-- fallback HTML content from GridStackWidget.content if used instead (not recommended) -->\n      {{options.content}}\n    </div>`,\n  styles: [`\n    :host { display: block; }\n  `],\n  standalone: true,\n  // changeDetection: ChangeDetectionStrategy.OnPush, // IFF you want to optimize and control when ChangeDetection needs to happen...\n})\nexport class GridstackItemComponent implements OnDestroy {\n\n  /**\n   * Container for dynamic component creation within this grid item.\n   * Used to append child components programmatically.\n   */\n  @ViewChild('container', { read: ViewContainerRef, static: true}) public container?: ViewContainerRef;\n\n  /**\n   * Component reference for dynamic component removal.\n   * Used internally when this component is created dynamically.\n   */\n  public ref: ComponentRef<GridstackItemComponent> | undefined;\n\n  /**\n   * Reference to child widget component for serialization.\n   * Used to save/restore additional data along with grid position.\n   */\n  public childWidget: BaseWidget | undefined;\n\n  /**\n   * Grid item configuration options.\n   * Defines position, size, and behavior of this grid item.\n   *\n   * @example\n   * ```typescript\n   * itemOptions: GridStackNode = {\n   *   x: 0, y: 0, w: 2, h: 1,\n   *   noResize: true,\n   *   content: 'Item content'\n   * };\n   * ```\n   */\n  @Input() public set options(val: GridStackNode) {\n    const grid = this.el.gridstackNode?.grid;\n    if (grid) {\n      // already built, do an update...\n      grid.update(this.el, val);\n    } else {\n      // store our custom element in options so we can update it and not re-create a generic div!\n      this._options = {...val, el: this.el};\n    }\n  }\n  /** return the latest grid options (from GS once built, otherwise initial values) */\n  public get options(): GridStackNode {\n    return this.el.gridstackNode || this._options || {el: this.el};\n  }\n\n  protected _options?: GridStackNode;\n\n  /** return the native element that contains grid specific fields as well */\n  public get el(): GridItemCompHTMLElement { return this.elementRef.nativeElement; }\n\n  /** clears the initial options now that we've built */\n  public clearOptions() {\n    delete this._options;\n  }\n\n  constructor(protected readonly elementRef: ElementRef<GridItemCompHTMLElement>) {\n    this.el._gridItemComp = this;\n  }\n\n  public ngOnDestroy(): void {\n    this.clearOptions();\n    delete this.childWidget\n    delete this.el._gridItemComp;\n    delete this.container;\n    delete this.ref;\n  }\n}\n"
  },
  {
    "path": "angular/projects/lib/src/lib/gridstack.component.ts",
    "content": "/**\n * gridstack.component.ts 12.4.3\n * Copyright (c) 2022-2024 Alain Dumesny - see GridStack root license\n */\n\nimport {\n  AfterContentInit, Component, ContentChildren, ElementRef, EventEmitter, Input,\n  OnDestroy, OnInit, Output, QueryList, Type, ViewChild, ViewContainerRef, reflectComponentType, ComponentRef\n} from '@angular/core';\nimport { NgIf } from '@angular/common';\nimport { Subscription } from 'rxjs';\nimport { GridHTMLElement, GridItemHTMLElement, GridStack, GridStackNode, GridStackOptions, GridStackWidget } from 'gridstack';\n\nimport { NgGridStackNode, NgGridStackWidget } from './types';\nimport { BaseWidget } from './base-widget';\nimport { GridItemCompHTMLElement, GridstackItemComponent } from './gridstack-item.component';\n\n/**\n * Event handler callback signatures for different GridStack events.\n * These types define the structure of data passed to Angular event emitters.\n */\n\n/** Callback for general events (enable, disable, etc.) */\nexport type eventCB = {event: Event};\n\n/** Callback for element-specific events (resize, drag, etc.) */\nexport type elementCB = {event: Event, el: GridItemHTMLElement};\n\n/** Callback for events affecting multiple nodes (change, etc.) */\nexport type nodesCB = {event: Event, nodes: GridStackNode[]};\n\n/** Callback for drop events with before/after node state */\nexport type droppedCB = {event: Event, previousNode: GridStackNode, newNode: GridStackNode};\n\n/**\n * Extended HTMLElement interface for the grid container.\n * Stores a back-reference to the Angular component for integration purposes.\n */\nexport interface GridCompHTMLElement extends GridHTMLElement {\n  /** Back-reference to the Angular GridStack component */\n  _gridComp?: GridstackComponent;\n}\n\n/**\n * Mapping of selector strings to Angular component types.\n * Used for dynamic component creation based on widget selectors.\n */\nexport type SelectorToType = {[key: string]: Type<object>};\n\n/**\n * Angular component wrapper for GridStack.\n *\n * This component provides Angular integration for GridStack grids, handling:\n * - Grid initialization and lifecycle\n * - Dynamic component creation and management\n * - Event binding and emission\n * - Integration with Angular change detection\n *\n * Use in combination with GridstackItemComponent for individual grid items.\n *\n * @example\n * ```html\n * <gridstack [options]=\"gridOptions\" (change)=\"onGridChange($event)\">\n *   <div empty-content>Drag widgets here</div>\n * </gridstack>\n * ```\n */\n@Component({\n  selector: 'gridstack',\n  template: `\n    <!-- content to show when when grid is empty, like instructions on how to add widgets -->\n    <ng-content select=\"[empty-content]\" *ngIf=\"isEmpty\"></ng-content>\n    <!-- where dynamic items go -->\n    <ng-template #container></ng-template>\n    <!-- where template items go -->\n    <ng-content></ng-content>\n  `,\n  styles: [`\n    :host { display: block; }\n  `],\n  standalone: true,\n  imports: [NgIf]\n  // changeDetection: ChangeDetectionStrategy.OnPush, // IFF you want to optimize and control when ChangeDetection needs to happen...\n})\nexport class GridstackComponent implements OnInit, AfterContentInit, OnDestroy {\n\n  /**\n   * List of template-based grid items (not recommended approach).\n   * Used to sync between DOM and GridStack internals when items are defined in templates.\n   * Prefer dynamic component creation instead.\n   */\n  @ContentChildren(GridstackItemComponent) public gridstackItems?: QueryList<GridstackItemComponent>;\n  /**\n   * Container for dynamic component creation (recommended approach).\n   * Used to append grid items programmatically at runtime.\n   */\n  @ViewChild('container', { read: ViewContainerRef, static: true}) public container?: ViewContainerRef;\n\n  /**\n   * Grid configuration options.\n   * Can be set before grid initialization or updated after grid is created.\n   *\n   * @example\n   * ```typescript\n   * gridOptions: GridStackOptions = {\n   *   column: 12,\n   *   cellHeight: 'auto',\n   *   animate: true\n   * };\n   * ```\n   */\n  @Input() public set options(o: GridStackOptions) {\n    if (this._grid) {\n      this._grid.updateOptions(o);\n    } else {\n      this._options = o;\n    }\n  }\n  /** Get the current running grid options */\n  public get options(): GridStackOptions { return this._grid?.opts || this._options || {}; }\n\n  /**\n   * Controls whether empty content should be displayed.\n   * Set to true to show ng-content with 'empty-content' selector when grid has no items.\n   *\n   * @example\n   * ```html\n   * <gridstack [isEmpty]=\"gridItems.length === 0\">\n   *   <div empty-content>Drag widgets here to get started</div>\n   * </gridstack>\n   * ```\n   */\n  @Input() public isEmpty?: boolean;\n\n  /**\n   * GridStack event emitters for Angular integration.\n   *\n   * These provide Angular-style event handling for GridStack events.\n   * Alternatively, use `this.grid.on('event1 event2', callback)` for multiple events.\n   *\n   * Note: 'CB' suffix prevents conflicts with native DOM events.\n   *\n   * @example\n   * ```html\n   * <gridstack (changeCB)=\"onGridChange($event)\" (droppedCB)=\"onItemDropped($event)\">\n   * </gridstack>\n   * ```\n   */\n\n  /** Emitted when widgets are added to the grid */\n  @Output() public addedCB = new EventEmitter<nodesCB>();\n\n  /** Emitted when grid layout changes */\n  @Output() public changeCB = new EventEmitter<nodesCB>();\n\n  /** Emitted when grid is disabled */\n  @Output() public disableCB = new EventEmitter<eventCB>();\n\n  /** Emitted during widget drag operations */\n  @Output() public dragCB = new EventEmitter<elementCB>();\n\n  /** Emitted when widget drag starts */\n  @Output() public dragStartCB = new EventEmitter<elementCB>();\n\n  /** Emitted when widget drag stops */\n  @Output() public dragStopCB = new EventEmitter<elementCB>();\n\n  /** Emitted when widget is dropped */\n  @Output() public droppedCB = new EventEmitter<droppedCB>();\n\n  /** Emitted when grid is enabled */\n  @Output() public enableCB = new EventEmitter<eventCB>();\n\n  /** Emitted when widgets are removed from the grid */\n  @Output() public removedCB = new EventEmitter<nodesCB>();\n\n  /** Emitted during widget resize operations */\n  @Output() public resizeCB = new EventEmitter<elementCB>();\n\n  /** Emitted when widget resize starts */\n  @Output() public resizeStartCB = new EventEmitter<elementCB>();\n\n  /** Emitted when widget resize stops */\n  @Output() public resizeStopCB = new EventEmitter<elementCB>();\n\n  /**\n   * Get the native DOM element that contains grid-specific fields.\n   * This element has GridStack properties attached to it.\n   */\n  public get el(): GridCompHTMLElement { return this.elementRef.nativeElement; }\n\n  /**\n   * Get the underlying GridStack instance.\n   * Use this to access GridStack API methods directly.\n   *\n   * @example\n   * ```typescript\n   * this.gridComponent.grid.addWidget({x: 0, y: 0, w: 2, h: 1});\n   * ```\n   */\n  public get grid(): GridStack | undefined { return this._grid; }\n\n  /**\n   * Component reference for dynamic component removal.\n   * Used internally when this component is created dynamically.\n   */\n  public ref: ComponentRef<GridstackComponent> | undefined;\n\n  /**\n   * Mapping of component selectors to their types for dynamic creation.\n   *\n   * This enables dynamic component instantiation from string selectors.\n   * Angular doesn't provide public access to this mapping, so we maintain our own.\n   *\n   * @example\n   * ```typescript\n   * GridstackComponent.addComponentToSelectorType([MyWidgetComponent]);\n   * ```\n   */\n  public static selectorToType: SelectorToType = {};\n  /**\n   * Register a list of Angular components for dynamic creation.\n   *\n   * @param typeList Array of component types to register\n   *\n   * @example\n   * ```typescript\n   * GridstackComponent.addComponentToSelectorType([\n   *   MyWidgetComponent,\n   *   AnotherWidgetComponent\n   * ]);\n   * ```\n   */\n  public static addComponentToSelectorType(typeList: Array<Type<object>>) {\n    typeList.forEach(type => GridstackComponent.selectorToType[ GridstackComponent.getSelector(type) ] = type);\n  }\n  /**\n   * Extract the selector string from an Angular component type.\n   *\n   * @param type The component type to get selector from\n   * @returns The component's selector string\n   */\n  public static getSelector(type: Type<object>): string {\n    // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n    return reflectComponentType(type)!.selector;\n  }\n\n  protected _options?: GridStackOptions;\n  protected _grid?: GridStack;\n  protected _sub: Subscription | undefined;\n  protected loaded?: boolean;\n\n  constructor(protected readonly elementRef: ElementRef<GridCompHTMLElement>) {\n    // set globally our method to create the right widget type\n    if (!GridStack.addRemoveCB) {\n      GridStack.addRemoveCB = gsCreateNgComponents;\n    }\n    if (!GridStack.saveCB) {\n      GridStack.saveCB = gsSaveAdditionalNgInfo;\n    }\n    if (!GridStack.updateCB) {\n      GridStack.updateCB = gsUpdateNgComponents;\n    }\n    this.el._gridComp = this;\n  }\n\n  public ngOnInit(): void {\n    // init ourself before any template children are created since we track them below anyway - no need to double create+update widgets\n    this.loaded = !!this.options?.children?.length;\n    this._grid = GridStack.init(this._options, this.el);\n    delete this._options; // GS has it now\n\n    this.checkEmpty();\n  }\n\n  /** wait until after all DOM is ready to init gridstack children (after angular ngFor and sub-components run first) */\n  public ngAfterContentInit(): void {\n    // track whenever the children list changes and update the layout...\n    this._sub = this.gridstackItems?.changes.subscribe(() => this.updateAll());\n    // ...and do this once at least unless we loaded children already\n    if (!this.loaded) this.updateAll();\n    this.hookEvents(this.grid);\n  }\n\n  public ngOnDestroy(): void {\n    this.unhookEvents(this._grid);\n    this._sub?.unsubscribe();\n    this._grid?.destroy();\n    delete this._grid;\n    delete this.el._gridComp;\n    delete this.container;\n    delete this.ref;\n  }\n\n  /**\n   * called when the TEMPLATE (not recommended) list of items changes - get a list of nodes and\n   * update the layout accordingly (which will take care of adding/removing items changed by Angular)\n   */\n  public updateAll() {\n    if (!this.grid) return;\n    const layout: GridStackWidget[] = [];\n    this.gridstackItems?.forEach(item => {\n      layout.push(item.options);\n      item.clearOptions();\n    });\n    this.grid.load(layout); // efficient that does diffs only\n  }\n\n  /** check if the grid is empty, if so show alternative content */\n  public checkEmpty() {\n    if (!this.grid) return;\n    this.isEmpty = !this.grid.engine.nodes.length;\n  }\n\n  /** get all known events as easy to use Outputs for convenience */\n  protected hookEvents(grid?: GridStack) {\n    if (!grid) return;\n    // nested grids don't have events in v12.1+ so skip\n    if (grid.parentGridNode) return;\n    grid\n      .on('added', (event: Event, nodes: GridStackNode[]) => {\n        const gridComp = (nodes[0].grid?.el as GridCompHTMLElement)._gridComp || this;\n        gridComp.checkEmpty();\n        this.addedCB.emit({event, nodes});\n      })\n      .on('change', (event: Event, nodes: GridStackNode[]) => this.changeCB.emit({event, nodes}))\n      .on('disable', (event: Event) => this.disableCB.emit({event}))\n      .on('drag', (event: Event, el: GridItemHTMLElement) => this.dragCB.emit({event, el}))\n      .on('dragstart', (event: Event, el: GridItemHTMLElement) => this.dragStartCB.emit({event, el}))\n      .on('dragstop', (event: Event, el: GridItemHTMLElement) => this.dragStopCB.emit({event, el}))\n      .on('dropped', (event: Event, previousNode: GridStackNode, newNode: GridStackNode) => this.droppedCB.emit({event, previousNode, newNode}))\n      .on('enable', (event: Event) => this.enableCB.emit({event}))\n      .on('removed', (event: Event, nodes: GridStackNode[]) => {\n        const gridComp = (nodes[0].grid?.el as GridCompHTMLElement)._gridComp || this;\n        gridComp.checkEmpty();\n        this.removedCB.emit({event, nodes});\n      })\n      .on('resize', (event: Event, el: GridItemHTMLElement) => this.resizeCB.emit({event, el}))\n      .on('resizestart', (event: Event, el: GridItemHTMLElement) => this.resizeStartCB.emit({event, el}))\n      .on('resizestop', (event: Event, el: GridItemHTMLElement) => this.resizeStopCB.emit({event, el}))\n  }\n\n  protected unhookEvents(grid?: GridStack) {\n    if (!grid) return;\n    // nested grids don't have events in v12.1+ so skip\n    if (grid.parentGridNode) return;\n    grid.off('added change disable drag dragstart dragstop dropped enable removed resize resizestart resizestop');\n  }\n}\n\n/**\n * can be used when a new item needs to be created, which we do as a Angular component, or deleted (skip)\n **/\nexport function gsCreateNgComponents(host: GridCompHTMLElement | HTMLElement, n: NgGridStackNode, add: boolean, isGrid: boolean): HTMLElement | undefined {\n  if (add) {\n    //\n    // create the component dynamically - see https://angular.io/docs/ts/latest/cookbook/dynamic-component-loader.html\n    //\n    if (!host) return;\n    if (isGrid) {\n      // TODO: figure out how to create ng component inside regular Div. need to access app injectors...\n      // if (!container) {\n      //   const hostElement: Element = host;\n      //   const environmentInjector: EnvironmentInjector;\n      //   grid = createComponent(GridstackComponent, {environmentInjector, hostElement})?.instance;\n      // }\n\n      const gridItemComp = (host.parentElement as GridItemCompHTMLElement)?._gridItemComp;\n      if (!gridItemComp) return;\n      // check if gridItem has a child component with 'container' exposed to create under..\n      // eslint-disable-next-line @typescript-eslint/no-explicit-any\n      const container = (gridItemComp.childWidget as any)?.container || gridItemComp.container;\n      const gridRef = container?.createComponent(GridstackComponent);\n      const grid = gridRef?.instance;\n      if (!grid) return;\n      grid.ref = gridRef;\n      grid.options = n;\n      return grid.el;\n    } else {\n      const gridComp = (host as GridCompHTMLElement)._gridComp;\n      const gridItemRef = gridComp?.container?.createComponent(GridstackItemComponent);\n      const gridItem = gridItemRef?.instance;\n      if (!gridItem) return;\n      gridItem.ref = gridItemRef\n\n      // define what type of component to create as child, OR you can do it GridstackItemComponent template, but this is more generic\n      const selector = n.selector;\n      const type = selector ? GridstackComponent.selectorToType[selector] : undefined;\n      if (type) {\n        // shared code to create our selector component\n        const createComp = () => {\n          const childWidget = gridItem.container?.createComponent(type)?.instance as BaseWidget;\n          // if proper BaseWidget subclass, save it and load additional data\n          if (childWidget && typeof childWidget.serialize === 'function' && typeof childWidget.deserialize === 'function') {\n            gridItem.childWidget = childWidget;\n            childWidget.deserialize(n);\n          }\n        }\n\n        const lazyLoad = n.lazyLoad || n.grid?.opts?.lazyLoad && n.lazyLoad !== false;\n        if (lazyLoad) {\n          if (!n.visibleObservable) {\n            n.visibleObservable = new IntersectionObserver(([entry]) => { if (entry.isIntersecting) {\n              n.visibleObservable?.disconnect();\n              delete n.visibleObservable;\n              createComp();\n            }});\n            window.setTimeout(() => n.visibleObservable?.observe(gridItem.el)); // wait until callee sets position attributes\n          }\n        } else createComp();\n      }\n\n      return gridItem.el;\n    }\n  } else {\n    //\n    // REMOVE - have to call ComponentRef:destroy() for dynamic objects to correctly remove themselves\n    // Note: this will destroy all children dynamic components as well: gridItem -> childWidget\n    //\n    if (isGrid) {\n      const grid = (n.el as GridCompHTMLElement)?._gridComp;\n      if (grid?.ref) grid.ref.destroy();\n      else grid?.ngOnDestroy();\n    } else {\n      const gridItem = (n.el as GridItemCompHTMLElement)?._gridItemComp;\n      if (gridItem?.ref) gridItem.ref.destroy();\n      else gridItem?.ngOnDestroy();\n    }\n  }\n  return;\n}\n\n/**\n * called for each item in the grid - check if additional information needs to be saved.\n * Note: since this is options minus gridstack protected members using Utils.removeInternalForSave(),\n * this typically doesn't need to do anything. However your custom Component @Input() are now supported\n * using BaseWidget.serialize()\n */\nexport function gsSaveAdditionalNgInfo(n: NgGridStackNode, w: NgGridStackWidget) {\n  const gridItem = (n.el as GridItemCompHTMLElement)?._gridItemComp;\n  if (gridItem) {\n    const input = gridItem.childWidget?.serialize();\n    if (input) {\n      w.input = input;\n    }\n    return;\n  }\n  // else check if Grid\n  const grid = (n.el as GridCompHTMLElement)?._gridComp;\n  if (grid) {\n    //.... save any custom data\n  }\n}\n\n/**\n * track when widgeta re updated (rather than created) to make sure we de-serialize them as well\n */\nexport function gsUpdateNgComponents(n: NgGridStackNode) {\n  const w: NgGridStackWidget = n;\n  const gridItem = (n.el as GridItemCompHTMLElement)?._gridItemComp;\n  if (gridItem?.childWidget && w.input) gridItem.childWidget.deserialize(w);\n}"
  },
  {
    "path": "angular/projects/lib/src/lib/gridstack.module.ts",
    "content": "/**\r\n * gridstack.component.ts 12.4.3\r\n * Copyright (c) 2022-2024 Alain Dumesny - see GridStack root license\r\n */\r\n\r\nimport { NgModule } from \"@angular/core\";\r\n\r\nimport { GridstackItemComponent } from \"./gridstack-item.component\";\r\nimport { GridstackComponent } from \"./gridstack.component\";\r\n\r\n/**\r\n * @deprecated Use GridstackComponent and GridstackItemComponent as standalone components instead.\r\n *\r\n * This NgModule is provided for backward compatibility but is no longer the recommended approach.\r\n * Import components directly in your standalone components or use the new Angular module structure.\r\n *\r\n * @example\r\n * ```typescript\r\n * // Preferred approach - standalone components\r\n * @Component({\r\n *   selector: 'my-app',\r\n *   imports: [GridstackComponent, GridstackItemComponent],\r\n *   template: '<gridstack></gridstack>'\r\n * })\r\n * export class AppComponent {}\r\n *\r\n * // Legacy approach (deprecated)\r\n * @NgModule({\r\n *   imports: [GridstackModule]\r\n * })\r\n * export class AppModule {}\r\n * ```\r\n */\r\n@NgModule({\r\n  imports: [\r\n    GridstackItemComponent,\r\n    GridstackComponent,\r\n  ],\r\n  exports: [\r\n    GridstackItemComponent,\r\n    GridstackComponent,\r\n  ],\r\n})\r\nexport class GridstackModule {}\r\n"
  },
  {
    "path": "angular/projects/lib/src/lib/types.ts",
    "content": "/**\r\n * gridstack-item.component.ts 12.4.3\r\n * Copyright (c) 2025 Alain Dumesny - see GridStack root license\r\n */\r\n\r\nimport { GridStackNode, GridStackOptions, GridStackWidget } from \"gridstack\";\r\n\r\n/**\r\n * Extended GridStackWidget interface for Angular integration.\r\n * Adds Angular-specific properties for dynamic component creation.\r\n */\r\nexport interface NgGridStackWidget extends GridStackWidget {\r\n  /** Angular component selector for dynamic creation (e.g., 'my-widget') */\r\n  selector?: string;\r\n  /** Serialized data for component @Input() properties */\r\n  input?: NgCompInputs;\r\n  /** Configuration for nested sub-grids */\r\n  subGridOpts?: NgGridStackOptions;\r\n}\r\n\r\n/**\r\n * Extended GridStackNode interface for Angular integration.\r\n * Adds component selector for dynamic content creation.\r\n */\r\nexport interface NgGridStackNode extends GridStackNode {\r\n  /** Angular component selector for this node's content */\r\n  selector?: string;\r\n}\r\n\r\n/**\r\n * Extended GridStackOptions interface for Angular integration.\r\n * Supports Angular-specific widget definitions and nested grids.\r\n */\r\nexport interface NgGridStackOptions extends GridStackOptions {\r\n  /** Array of Angular widget definitions for initial grid setup */\r\n  children?: NgGridStackWidget[];\r\n  /** Configuration for nested sub-grids (Angular-aware) */\r\n  subGridOpts?: NgGridStackOptions;\r\n}\r\n\r\n/**\r\n * Type for component input data serialization.\r\n * Maps @Input() property names to their values for widget persistence.\r\n *\r\n * @example\r\n * ```typescript\r\n * const inputs: NgCompInputs = {\r\n *   title: 'My Widget',\r\n *   value: 42,\r\n *   config: { enabled: true }\r\n * };\r\n * ```\r\n */\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\nexport type NgCompInputs = {[key: string]: any};\r\n"
  },
  {
    "path": "angular/projects/lib/src/test.ts",
    "content": "// This file is required by karma.conf.js and loads recursively all the .spec and framework files\n\nimport 'zone.js';\nimport 'zone.js/testing';\nimport { getTestBed } from '@angular/core/testing';\nimport {\n  BrowserDynamicTestingModule,\n  platformBrowserDynamicTesting\n} from '@angular/platform-browser-dynamic/testing';\n\ndeclare const require: {\n  context(path: string, deep?: boolean, filter?: RegExp): {\n    <T>(id: string): T;\n    keys(): string[];\n  };\n};\n\n// First, initialize the Angular testing environment.\ngetTestBed().initTestEnvironment(\n  BrowserDynamicTestingModule,\n  platformBrowserDynamicTesting(),\n);\n\n// Then we find all the tests.\nconst context = require.context('./', true, /\\.spec\\.ts$/);\n// And load the modules.\ncontext.keys().forEach(context);\n"
  },
  {
    "path": "angular/projects/lib/tsconfig.lib.json",
    "content": "/* To learn more about this file see: https://angular.io/config/tsconfig. */\n{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../../out-tsc/lib\",\n    \"declaration\": true,\n    \"declarationMap\": true,\n    \"inlineSources\": true,\n    \"types\": []\n  },\n  \"exclude\": [\n    \"src/test.ts\",\n    \"**/*.spec.ts\"\n  ]\n}\n"
  },
  {
    "path": "angular/projects/lib/tsconfig.lib.prod.json",
    "content": "/* To learn more about this file see: https://angular.io/config/tsconfig. */\n{\n  \"extends\": \"./tsconfig.lib.json\",\n  \"compilerOptions\": {\n    \"declarationMap\": false\n  },\n  \"angularCompilerOptions\": {\n    \"compilationMode\": \"partial\"\n  }\n}\n"
  },
  {
    "path": "angular/projects/lib/tsconfig.spec.json",
    "content": "/* To learn more about this file see: https://angular.io/config/tsconfig. */\n{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"../../out-tsc/spec\",\n    \"types\": [\n      \"jasmine\"\n    ]\n  },\n  \"files\": [\n    \"src/test.ts\"\n  ],\n  \"include\": [\n    \"**/*.spec.ts\",\n    \"**/*.d.ts\"\n  ]\n}\n"
  },
  {
    "path": "angular/tsconfig.doc.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"compilerOptions\": {\n    \"declaration\": true,\n    \"emitDeclarationOnly\": true,\n    \"skipLibCheck\": true\n  },\n  \"include\": [\n    \"projects/lib/src/lib/**/*.ts\"\n  ],\n  \"exclude\": [\n    \"projects/demo/**/*\",\n    \"**/*.spec.ts\",\n    \"**/*.test.ts\",\n    \"node_modules/**\"\n  ]\n}\n"
  },
  {
    "path": "angular/tsconfig.json",
    "content": "/* To learn more about this file see: https://angular.io/config/tsconfig. */\n{\n  \"compileOnSave\": false,\n  \"compilerOptions\": {\n    \"baseUrl\": \"./\",\n    \"outDir\": \"./dist/out-tsc\",\n    \"forceConsistentCasingInFileNames\": true,\n    \"strict\": true,\n    \"noImplicitOverride\": true,\n    \"paths\": {\n      \"lib\": [\n        \"../dist/angular\"\n      ]\n    },\n    \"noPropertyAccessFromIndexSignature\": true,\n    \"noImplicitReturns\": true,\n    \"noFallthroughCasesInSwitch\": true,\n    \"sourceMap\": true,\n    \"declaration\": false,\n    \"downlevelIteration\": true,\n    \"experimentalDecorators\": true,\n    \"moduleResolution\": \"node\",\n    \"importHelpers\": true,\n    \"target\": \"es2020\",\n    \"module\": \"es2020\",\n    \"lib\": [\n      \"es2020\",\n      \"dom\"\n    ]\n  },\n  \"angularCompilerOptions\": {\n    \"enableI18nLegacyMessageIdFormat\": false,\n    \"strictInjectionParameters\": true,\n    \"strictInputAccessModifiers\": true,\n    \"strictTemplates\": true\n  }\n}\n"
  },
  {
    "path": "angular/typedoc.html.json",
    "content": "{\n  \"$schema\": \"https://typedoc.org/schema.json\",\n  \"entryPoints\": [\n    \"projects/lib/src/lib/gridstack.component.ts\",\n    \"projects/lib/src/lib/gridstack-item.component.ts\", \n    \"projects/lib/src/lib/gridstack.module.ts\",\n    \"projects/lib/src/lib/base-widget.ts\",\n    \"projects/lib/src/lib/types.ts\"\n  ],\n  \"tsconfig\": \"tsconfig.doc.json\",\n  \"excludeExternals\": false,\n  \"out\": \"doc/html\",\n  \"exclude\": [\n    \"**/*.spec.ts\",\n    \"**/*.test.ts\",\n    \"**/spec/**\",\n    \"**/test/**\",\n    \"**/demo/**\",\n    \"projects/demo/**\",\n    \"**/app.component.ts\",\n    \"**/simple.ts\",\n    \"**/ngFor.ts\",\n    \"**/ngFor_cmd.ts\",\n    \"**/dummy.component.ts\",\n    \"node_modules/**\"\n  ],\n  \"excludePrivate\": true,\n  \"excludeProtected\": false,\n  \"excludeInternal\": true,\n  \"includeVersion\": true,\n  \"sort\": [\"source-order\"],\n  \"sortEntryPoints\": false,\n  \"kindSortOrder\": [\n    \"Class\",\n    \"Interface\", \n    \"TypeAlias\",\n    \"Variable\",\n    \"Function\"\n  ],\n  \"groupOrder\": [\n    \"Modules\",\n    \"Components\",\n    \"Classes\",\n    \"Interfaces\",\n    \"Type aliases\",\n    \"Variables\",\n    \"Functions\"\n  ],\n  \"categorizeByGroup\": true,\n  \"defaultCategory\": \"Other\",\n  \"categoryOrder\": [\n    \"Main\",\n    \"Components\",\n    \"Angular Integration\",\n    \"Types\",\n    \"Utilities\",\n    \"*\"\n  ],\n  \"readme\": \"README.md\",\n  \"theme\": \"default\",\n  \"hideGenerator\": false,\n  \"searchInComments\": true,\n  \"searchInDocuments\": true,\n  \"cleanOutputDir\": true,\n  \"titleLink\": \"https://gridstackjs.com/\",\n  \"navigationLinks\": {\n    \"GitHub\": \"https://github.com/gridstack/gridstack.js\",\n    \"Demo\": \"https://gridstackjs.com/demo/\",\n    \"Main Library\": \"../../../doc/html/index.html\"\n  },\n  \"sidebarLinks\": {\n    \"Documentation\": \"https://github.com/gridstack/gridstack.js/blob/master/README.md\",\n    \"Angular Guide\": \"index.html\"\n  },\n  \"hostedBaseUrl\": \"https://gridstack.github.io/gridstack.js/angular/\",\n  \"githubPages\": true,\n  \"gitRevision\": \"master\",\n  \"gitRemote\": \"origin\",\n  \"name\": \"GridStack Angular Library\"\n}\n"
  },
  {
    "path": "angular/typedoc.json",
    "content": "{\n  \"$schema\": \"https://typedoc.org/schema.json\",\n  \"entryPoints\": [\n    \"projects/lib/src/lib/gridstack.component.ts\",\n    \"projects/lib/src/lib/gridstack-item.component.ts\", \n    \"projects/lib/src/lib/gridstack.module.ts\",\n    \"projects/lib/src/lib/base-widget.ts\",\n    \"projects/lib/src/lib/types.ts\"\n  ],\n  \"tsconfig\": \"tsconfig.doc.json\",\n  \"excludeExternals\": false,\n  \"out\": \"doc/api\",\n  \"plugin\": [\"typedoc-plugin-markdown\"],\n  \"theme\": \"markdown\",\n  \"exclude\": [\n    \"**/*.spec.ts\",\n    \"**/*.test.ts\",\n    \"**/spec/**\",\n    \"**/test/**\",\n    \"**/demo/**\",\n    \"projects/demo/**\",\n    \"**/app.component.ts\",\n    \"**/simple.ts\",\n    \"**/ngFor.ts\",\n    \"**/ngFor_cmd.ts\",\n    \"**/dummy.component.ts\",\n    \"node_modules/**\"\n  ],\n  \"excludePrivate\": true,\n  \"excludeProtected\": false,\n  \"excludeInternal\": true,\n  \"includeVersion\": true,\n  \"sort\": [\"source-order\"],\n  \"sortEntryPoints\": false,\n  \"kindSortOrder\": [\n    \"Class\",\n    \"Interface\", \n    \"TypeAlias\",\n    \"Variable\",\n    \"Function\"\n  ],\n  \"groupOrder\": [\n    \"Modules\",\n    \"Components\",\n    \"Classes\",\n    \"Interfaces\",\n    \"Type aliases\",\n    \"Variables\",\n    \"Functions\"\n  ],\n  \"categorizeByGroup\": true,\n  \"defaultCategory\": \"Other\",\n  \"categoryOrder\": [\n    \"Main\",\n    \"Components\",\n    \"Angular Integration\",\n    \"Types\",\n    \"Utilities\",\n    \"*\"\n  ],\n  \"readme\": \"none\",\n  \"hidePageHeader\": true,\n  \"hideBreadcrumbs\": true,\n  \"hidePageTitle\": false,\n  \"disableSources\": false,\n  \"useCodeBlocks\": true,\n  \"indexFormat\": \"table\",\n  \"parametersFormat\": \"table\",\n  \"interfacePropertiesFormat\": \"table\",\n  \"classPropertiesFormat\": \"table\",\n  \"enumMembersFormat\": \"table\",\n  \"typeDeclarationFormat\": \"table\",\n  \"propertyMembersFormat\": \"table\",\n  \"expandObjects\": false,\n  \"expandParameters\": false,\n  \"blockTagsPreserveOrder\": [\n    \"@param\",\n    \"@returns\",\n    \"@throws\"\n  ],\n  \"outputFileStrategy\": \"modules\",\n  \"mergeReadme\": false,\n  \"entryFileName\": \"index\",\n  \"cleanOutputDir\": true,\n  \"excludeReferences\": true,\n  \"gitRevision\": \"master\",\n  \"gitRemote\": \"origin\",\n  \"name\": \"GridStack Angular Library\"\n}\n"
  },
  {
    "path": "demo/anijs.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\" />\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n  <title>AniJS demo</title>\n\n  <link rel=\"stylesheet\" href=\"https://anijs.github.io/lib/anicollection/anicollection.css\" />\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n\n  <script src=\"../dist/gridstack-all.js\"></script>\n  <script src=\"https://cdnjs.cloudflare.com/ajax/libs/AniJS/0.9.3/anijs.js\"></script>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>AniJS demo</h1>\n    <div>\n      <a onClick=\"addWidget()\" class=\"btn btn-primary\" href=\"#\">Add Widget</a>\n    </div>\n    <h4>Widget added</h4>\n    <br>\n    <div class=\"grid-stack\"></div>\n  </div>\n\n  <script type=\"text/javascript\">\n    let grid = GridStack.init();\n    let self = this;\n    grid.on('added', function(e, items) {\n      // add anijs data to gridstack item\n      for (let i = 0; i < items.length; i++) {\n        items[i].el.setAttribute('data-anijs', 'if: added, do: swing animated, after: $removeAnimations, on: $gridstack');\n      }\n      AniJS.run();\n      self.gridstackNotifier = AniJS.getNotifier('gridstack');\n      // fire added event!\n      self.gridstackNotifier.dispatchEvent('added');\n    });\n\n    function addWidget() {\n      grid.addWidget({w: Math.floor(1 + 3 * Math.random()), h: Math.floor(1 + 3 * Math.random())});\n    };\n\n    let animationHelper = AniJS.getHelper();\n\n    //Defining removeAnimations to remove existing animations\n    animationHelper.removeAnimations = function(e, animationContext) {\n      document.querySelectorAll('.grid-stack-item').forEach( function(el) {\n        el.removeAttribute('data-anijs');\n      });\n    }\n\n    addWidget();\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/canvasJS.html",
    "content": "<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<head>\r\n  <title>CanvasJS grid demo</title>\r\n\r\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\r\n  <script src=\"https://cdn.jsdelivr.net/npm/gridstack@5.1.1/dist/gridstack-jq.js\"></script>\r\n  <script src=\"https://canvasjs.com/assets/script/canvasjs.min.js\"></script>\r\n\r\n  <style type=\"text/css\">\r\n    body { margin: 8px 0; } /* make grid take entire vw so we have correct square cells */\r\n  </style>\r\n</head>\r\n<body>\r\n<div>\r\n  <h1>CanvasJS grid demo</h1>\r\n  <br/>\r\n  <div class=\"grid-stack\">\r\n  </div>\r\n</div>\r\n\r\n<script type=\"text/javascript\">\r\n  let grid = GridStack.init({\r\n    cellHeight: 'initial', // start square but will set to % of window width later\r\n    animate: false, // show immediate (animate: true is nice for user dragging though)\r\n    float: true\r\n  });\r\n\r\n  let items = [ // our initial 12 column layout loaded first so we can compare\r\n    {x: 1, y: 1, w: 7, h:3 , content: '<div id=\"chartContainer\" style=\"height: 370px; width: 100%;\"></div>'},\r\n  ];\r\n  grid.load(items);\r\n\r\n  var chart = new CanvasJS.Chart(\"chartContainer\", {\r\n    animationEnabled: true,\r\n    title:{\r\n      text: \"Company Revenue by Year\"\r\n    },\r\n    axisY: {\r\n      title: \"Revenue in USD\",\r\n      valueFormatString: \"#0,,.\",\r\n      suffix: \"mn\",\r\n      prefix: \"$\"\r\n    },\r\n    data: [{\r\n      type: \"splineArea\",\r\n      color: \"rgba(54,158,173,.7)\",\r\n      markerSize: 5,\r\n      xValueFormatString: \"YYYY\",\r\n      yValueFormatString: \"$#,##0.##\",\r\n      dataPoints: [\r\n        { x: new Date(2000, 0), y: 3289000 },\r\n        { x: new Date(2001, 0), y: 3830000 },\r\n        { x: new Date(2002, 0), y: 2009000 },\r\n        { x: new Date(2003, 0), y: 2840000 },\r\n        { x: new Date(2004, 0), y: 2396000 },\r\n        { x: new Date(2005, 0), y: 1613000 },\r\n        { x: new Date(2006, 0), y: 2821000 },\r\n        { x: new Date(2007, 0), y: 2000000 },\r\n        { x: new Date(2008, 0), y: 1397000 },\r\n        { x: new Date(2009, 0), y: 2506000 },\r\n        { x: new Date(2010, 0), y: 2798000 },\r\n        { x: new Date(2011, 0), y: 3386000 },\r\n        { x: new Date(2012, 0), y: 6704000},\r\n        { x: new Date(2013, 0), y: 6026000 },\r\n        { x: new Date(2014, 0), y: 2394000 },\r\n        { x: new Date(2015, 0), y: 1872000 },\r\n        { x: new Date(2016, 0), y: 2140000 }\r\n      ]\r\n    }]\r\n  });\r\n  chart.render();\r\n</script>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "demo/cell-height.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>cell height demo</title>\n\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <script src=\"../dist/gridstack-all.js\"></script>\n  <style type=\"text/css\">\n  .container {\n    background-color: lightblue;\n    width: 100%;\n    height: 800px;\n  }\n  </style>\n\n</head>\n<body>\n  <div class=\"container\">\n    <h1>Cell Height grid options demo</h1>\n    <p>sample showing the different cellHeight options and what happens when you resize the window</p>\n    <div>\n      <a class=\"btn btn-primary\" onClick=\"setOpt('auto')\" href=\"#\">auto</a>\n      <a class=\"btn btn-primary\" onClick=\"setOpt('initial')\" href=\"#\">initial</a>\n      <a class=\"btn btn-primary\" onClick=\"setOpt(100)\" href=\"#\">100px</a>\n      <a class=\"btn btn-primary\" onClick=\"setOpt('10vh')\" href=\"#\">'10vh'</a>\n      <a class=\"btn btn-primary\" onClick=\"setOpt('10%')\" href=\"#\">'10%' of blue (broken)</a>\n      <span>settings:</span><span id=\"info\"></span>\n    </div>\n    <br>\n    <div class=\"grid-stack\"></div>\n  </div>\n  <script type=\"text/javascript\">\n    let opts = {\n      cellHeight: 'auto', // see other possible values (best to do in here)\n      cellHeightThrottle: 100,\n    }\n    let grid = GridStack.init(opts);\n    let items = [\n      {x:0, y:0, content:'0'},\n      {x:1, y:0, w:2, content:'1'},\n      {x:3, y:0, h:2, content:'2'},\n    ];\n    grid.load(items);\n\n    let info = document.querySelector('#info');\n    info.innerHTML = opts.cellHeight;\n    setOpt = function(val) {\n      grid.cellHeight(val);\n      info.innerHTML = val;\n    }\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/column.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Column grid demo</title>\n\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <script src=\"../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>column() grid demo (fix cellHeight)</h1>\n    <div><span>Number of Columns:</span> <span id=\"column-text\">12</span></div>\n    <div>\n      <label>Choose re-layout:</label>\n      <select onchange=\"setLayout(this.value)\">\n        <option value=\"list\">list</option>\n        <option value=\"compact\">compact</option>\n        <option value=\"moveScale\">move + scale</option>\n        <option value=\"move\">move</option>\n        <option value=\"scale\">scale</option>\n        <option value=\"none\">none</option>\n        <option value=\"custom\">custom</option>\n      </select>\n    </div>\n    <div>\n      load:\n      <a onClick=\"grid.removeAll().load(list)\" class=\"btn btn-primary\" href=\"#\">list</a>\n      <a onClick=\"grid.removeAll().load(test1)\" class=\"btn btn-primary\" href=\"#\">case 1</a>\n      <a onClick=\"random()\" class=\"btn btn-primary\" href=\"#\">random</a>\n      <a onClick=\"addWidget()\" class=\"btn btn-primary\" href=\"#\">Add Widget</a>\n      column:\n      <a onClick=\"column(1)\" class=\"btn btn-primary\" href=\"#\">1</a>\n      <a onClick=\"column(2)\" class=\"btn btn-primary\" href=\"#\">2</a>\n      <a onClick=\"column(3)\" class=\"btn btn-primary\" href=\"#\">3</a>\n      <a onClick=\"column(4)\" class=\"btn btn-primary\" href=\"#\">4</a>\n      <a onClick=\"column(6)\" class=\"btn btn-primary\" href=\"#\">6</a>\n      <a onClick=\"column(8)\" class=\"btn btn-primary\" href=\"#\">8</a>\n      <a onClick=\"column(10)\" class=\"btn btn-primary\" href=\"#\">10</a>\n      <a onClick=\"column(12)\" class=\"btn btn-primary\" href=\"#\">12</a>\n    </div>\n    <br>\n    <div class=\"grid-stack\"></div>\n  </div>\n\n  <script type=\"text/javascript\">\n    // NOTE: REAL apps would sanitize-html or DOMPurify before blinding setting innerHTML. see #2736\n    GridStack.renderCB = function(el, w) {\n      el.innerHTML = w.content;\n    };\n\n    let test1 = [ // DOM order will be 0,1,2,3,4,5,6 vs column1 = 0,1,4,3,2,5,6\n      /* match karma testing\n      {x: 0, y: 0, w: 4, h: 2},\n      {x: 4, y: 0, w: 4, h: 4},\n      {text: ' auto'},\n      */\n      {x: 0, y: 0, w: 2, h: 2},\n      {x: 2, y: 0, w: 2},\n      {x: 5, y: 1},\n      {x: 5, y: 0, w: 2},\n      // {x: 0, y: 0}, // conflict\n      {text: ' auto'}, // autoPosition testing\n      // {x: 4, y: 0}, // same auto-pos\n      {x: 5, y: 3, w: 2},\n      {x: 0, y: 4, w: 12}\n    ];\n    let list = [{h:2},{},{},{},{},{},{},{},{},{w:2},{},{},{},{},{},{}];\n    list.forEach((n,i) => {\n      n.content = '<button onClick=\"grid.removeWidget(this.parentNode.parentNode)\">X</button><br>' + ++i;\n    });\n    let count = 0;\n    test1.forEach(n => {\n      n.content = '<button onClick=\"grid.removeWidget(this.parentNode.parentNode)\">X</button><br>' + count++ + (n.text ? n.text : '');\n    });\n\n    let grid = GridStack.init({\n      float: true,\n      cellHeight: 100 // fixed as default 'auto' (square) makes it hard to test 1-3 column in actual large windows tests\n    }).load(list);\n    let text = document.querySelector('#column-text');\n    let layout = 'list';\n\n    grid.on('added removed change', function(e, items) {\n      let str = '';\n      items.forEach(function(item) { str += ' (x,y)=' + item.x + ',' + item.y; });\n      console.log(e.type + ' ' + items.length + ' items:' + str );\n    });\n\n\n    function random() {\n      grid.removeAll();\n      count = 0;\n      for (i=0; i<8; i++) addWidget(true);\n    }\n\n    function addWidget() {\n      let n = {\n        w: Math.round(1 + 3 * Math.random()),\n        h: Math.round(1 + 3 * Math.random()),\n        content: '<button onClick=\"grid.removeWidget(this.parentNode.parentNode)\">X</button><br>' + count++,\n      };\n      grid.addWidget(n);\n    };\n\n    function column(n) {\n      grid.column(n, layout);\n      text.innerHTML = n;\n    }\n    // dummy test method that moves items to the right each new layout... grid engine will validate those values (can't be neg or out of bounds) anyway...\n    function columnLayout(column, oldColumn, nodes, oldNodes) {\n      oldNodes.forEach(n => {\n        n.x = n.x + 1;\n        nodes.push(n);\n      });\n      oldNodes.length = 0;\n    }\n    function setLayout(name) {\n      layout = name === 'custom' ? this.columnLayout : name;\n    }\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/css_attributes.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>CSS & attributes demo</title>\n\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <script src=\"../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Demo showcasing how to use gridstack.js attributes in CSS</h1>\n    <p>The center of the widget shows its dimensions by purely using CSS, no JavaScript involved.</p>\n    <div>\n      <a class=\"btn btn-primary\" onClick=\"addNewWidget()\" href=\"#\">Add Widget</a>\n    </div>\n    <br><br>\n    <div class=\"grid-stack show-dimensions\"></div>\n  </div>\n  <script src=\"events.js\"></script>\n  <script type=\"text/javascript\">\n    let grid = GridStack.init({\n      float: true,\n      resizable: { handles: 'all'}\n    });\n    addEvents(grid);\n\n    let items = [\n      {x: 1, y: 1},\n      {x: 2, y: 2, w: 3},\n      {x: 4, y: 2},\n      {x: 3, y: 1, h: 2},\n      {x: 0, y: 6, w: 2, h: 2}\n    ];\n    let count = 0;\n\n    getNode = function() {\n      let n = items[count] || {\n        x: Math.round(12 * Math.random()),\n        y: Math.round(5 * Math.random()),\n        w: Math.round(1 + 3 * Math.random()),\n        h: Math.round(1 + 3 * Math.random())\n      };\n      n.content = n.content || String(count);\n      count++;\n      return n;\n    };\n\n    addNewWidget = function() {\n      grid.addWidget(getNode());\n    };\n\n    addNewWidget();\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/custom-engine.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Custom Engine</title>\n\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <!-- <script src=\"../dist/gridstack-all.js\"></script> -->\n  <script src=\"events.js\"></script>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Custom Engine</h1>\n    <p>shows a custom engine subclass in Typescript that only allows objects to move vertically.</p>\n    <div>\n      <a class=\"btn btn-primary\" onClick=\"addNewWidget()\" href=\"#\">Add Widget</a>\n      <a class=\"btn btn-primary\" onclick=\"toggleFloat()\" id=\"float\" href=\"#\">float: true</a>\n    </div>\n    <br><br>\n    <div class=\"grid-stack\"></div>\n  </div>\n\n  <script type=\"module\" > // so we can use import\n    // get CORS error in Chrome...need to have http://localhost/ URL - see https://stackoverflow.com/questions/50197495/javascript-modules-and-cors\n    import { GridStack, GridStackEngine } from '../dist/gridstack-all.js';\n\n    /**\n     * Custom engine class that only allows vertical movement and resizing\n     */\n    class CustomEngine extends GridStackEngine {\n      /** refined this to move the node to the given new location */\n      moveNode(node, o) {\n        // keep the same original X and Width and let base do it all...\n        o.x = node.x;\n        o.w = node.w;\n        return super.moveNode(node, o);\n      }\n    }\n    GridStack.registerEngine(CustomEngine); // globally set our custom class\n\n    let count = 0;\n    let items = [\n      {x: 0, y: 0},\n      {x: 1, y: 0},\n      {x: 1, y: 2, w: 3},\n    ];\n    items.forEach(n => n.content = String(count++));\n\n    let grid = GridStack.init({\n      float: true, \n      cellHeight: 70\n    }).load(items);\n    addEvents(grid);\n\n    let addNewWidget = function() {\n      let n = items[count] || {\n        x: Math.round(12 * Math.random()),\n        y: Math.round(5 * Math.random()),\n        w: Math.round(1 + 3 * Math.random()),\n        h: Math.round(1 + 3 * Math.random())\n      };\n      n.content = n.content || String(count++);\n      grid.addWidget(n);\n    };\n\n    let toggleFloat = function() {\n      grid.float(! grid.getFloat());\n      document.querySelector('#float').innerHTML = 'float: ' + grid.getFloat();\n    };\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/demo.css",
    "content": "/* required file for gridstack to work */\r\n@import \"../dist/gridstack.css\";\r\n\r\n/* Optional styles for demos */\r\n.btn-primary {\r\n  color: #fff;\r\n  background-color: #007bff;\r\n}\r\n\r\n.btn {\r\n  display: inline-block;\r\n  padding: .375rem .75rem;\r\n  line-height: 1.5;\r\n  border-radius: .25rem;\r\n}\r\n\r\na {\r\n  text-decoration: none;\r\n}\r\n\r\nh1 {\r\n  font-size: 2.5rem;\r\n  margin-bottom: .5rem;\r\n}\r\n\r\n.sidebar {\r\n  background: rgb(215, 243, 215);\r\n  padding: 25px 0;\r\n  height: 100px;\r\n  text-align: center;\r\n}\r\n.sidebar > .grid-stack-item,\r\n.sidebar-item {\r\n  width: 100px;\r\n  height: 50px;\r\n  border: 2px dashed green;\r\n  text-align: center;\r\n  line-height: 35px;\r\n  background: rgb(192, 231, 192);\r\n  cursor: default;\r\n  display: inline-block;\r\n}\r\n\r\n.grid-stack {\r\n  background: #FAFAD2;\r\n}\r\n.grid-stack.grid-stack-static {\r\n  background: #eee;\r\n}\r\n\r\n.sidebar > .grid-stack-item,\r\n.grid-stack-item-content {\r\n  text-align: center;\r\n  background-color: #18bc9c;\r\n}\r\n\r\n.card-header {\r\n  margin: 0;\r\n  cursor: grab;\r\n  min-height: 25px;\r\n  background-color: #16af91;\r\n}\r\n.card-header:hover {\r\n  background-color: #149b80;\r\n}\r\n.grid-stack-dragging {\r\n  cursor: grabbing;\r\n}\r\n\r\n.ui-draggable-disabled.ui-resizable-disabled > .grid-stack-item-content {\r\n  background-color: #777;\r\n}\r\n\r\n.grid-stack-item-removing {\r\n  opacity: 0.5;\r\n}\r\n.trash {\r\n  height: 100px;\r\n  background: rgba(255, 0, 0, 0.1) center center url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjY0cHgiIGhlaWdodD0iNjRweCIgdmlld0JveD0iMCAwIDQzOC41MjkgNDM4LjUyOSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNDM4LjUyOSA0MzguNTI5OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPGc+CgkJPHBhdGggZD0iTTQxNy42ODksNzUuNjU0Yy0xLjcxMS0xLjcwOS0zLjkwMS0yLjU2OC02LjU2My0yLjU2OGgtODguMjI0TDMwMi45MTcsMjUuNDFjLTIuODU0LTcuMDQ0LTcuOTk0LTEzLjA0LTE1LjQxMy0xNy45ODkgICAgQzI4MC4wNzgsMi40NzMsMjcyLjU1NiwwLDI2NC45NDUsMGgtOTEuMzYzYy03LjYxMSwwLTE1LjEzMSwyLjQ3My0yMi41NTQsNy40MjFjLTcuNDI0LDQuOTQ5LTEyLjU2MywxMC45NDQtMTUuNDE5LDE3Ljk4OSAgICBsLTE5Ljk4NSw0Ny42NzZoLTg4LjIyYy0yLjY2NywwLTQuODUzLDAuODU5LTYuNTY3LDIuNTY4Yy0xLjcwOSwxLjcxMy0yLjU2OCwzLjkwMy0yLjU2OCw2LjU2N3YxOC4yNzQgICAgYzAsMi42NjQsMC44NTUsNC44NTQsMi41NjgsNi41NjRjMS43MTQsMS43MTIsMy45MDQsMi41NjgsNi41NjcsMi41NjhoMjcuNDA2djI3MS44YzAsMTUuODAzLDQuNDczLDI5LjI2NiwxMy40MTgsNDAuMzk4ICAgIGM4Ljk0NywxMS4xMzksMTkuNzAxLDE2LjcwMywzMi4yNjQsMTYuNzAzaDIzNy41NDJjMTIuNTY2LDAsMjMuMzE5LTUuNzU2LDMyLjI2NS0xNy4yNjhjOC45NDUtMTEuNTIsMTMuNDE1LTI1LjE3NCwxMy40MTUtNDAuOTcxICAgIFYxMDkuNjI3aDI3LjQxMWMyLjY2MiwwLDQuODUzLTAuODU2LDYuNTYzLTIuNTY4YzEuNzA4LTEuNzA5LDIuNTctMy45LDIuNTctNi41NjRWODIuMjIxICAgIEM0MjAuMjYsNzkuNTU3LDQxOS4zOTcsNzcuMzY3LDQxNy42ODksNzUuNjU0eiBNMTY5LjMwMSwzOS42NzhjMS4zMzEtMS43MTIsMi45NS0yLjc2Miw0Ljg1My0zLjE0aDkwLjUwNCAgICBjMS45MDMsMC4zODEsMy41MjUsMS40Myw0Ljg1NCwzLjE0bDEzLjcwOSwzMy40MDRIMTU1LjMxMUwxNjkuMzAxLDM5LjY3OHogTTM0Ny4xNzMsMzgwLjI5MWMwLDQuMTg2LTAuNjY0LDguMDQyLTEuOTk5LDExLjU2MSAgICBjLTEuMzM0LDMuNTE4LTIuNzE3LDYuMDg4LTQuMTQxLDcuNzA2Yy0xLjQzMSwxLjYyMi0yLjQyMywyLjQyNy0yLjk5OCwyLjQyN0gxMDAuNDkzYy0wLjU3MSwwLTEuNTY1LTAuODA1LTIuOTk2LTIuNDI3ICAgIGMtMS40MjktMS42MTgtMi44MS00LjE4OC00LjE0My03LjcwNmMtMS4zMzEtMy41MTktMS45OTctNy4zNzktMS45OTctMTEuNTYxVjEwOS42MjdoMjU1LjgxNVYzODAuMjkxeiIgZmlsbD0iI2ZmOWNhZSIvPgoJCTxwYXRoIGQ9Ik0xMzcuMDQsMzQ3LjE3MmgxOC4yNzFjMi42NjcsMCw0Ljg1OC0wLjg1NSw2LjU2Ny0yLjU2N2MxLjcwOS0xLjcxOCwyLjU2OC0zLjkwMSwyLjU2OC02LjU3VjE3My41ODEgICAgYzAtMi42NjMtMC44NTktNC44NTMtMi41NjgtNi41NjdjLTEuNzE0LTEuNzA5LTMuODk5LTIuNTY1LTYuNTY3LTIuNTY1SDEzNy4wNGMtMi42NjcsMC00Ljg1NCwwLjg1NS02LjU2NywyLjU2NSAgICBjLTEuNzExLDEuNzE0LTIuNTY4LDMuOTA0LTIuNTY4LDYuNTY3djE2NC40NTRjMCwyLjY2OSwwLjg1NCw0Ljg1MywyLjU2OCw2LjU3QzEzMi4xODYsMzQ2LjMxNiwxMzQuMzczLDM0Ny4xNzIsMTM3LjA0LDM0Ny4xNzJ6IiBmaWxsPSIjZmY5Y2FlIi8+CgkJPHBhdGggZD0iTTIxMC4xMjksMzQ3LjE3MmgxOC4yNzFjMi42NjYsMCw0Ljg1Ni0wLjg1NSw2LjU2NC0yLjU2N2MxLjcxOC0xLjcxOCwyLjU2OS0zLjkwMSwyLjU2OS02LjU3VjE3My41ODEgICAgYzAtMi42NjMtMC44NTItNC44NTMtMi41NjktNi41NjdjLTEuNzA4LTEuNzA5LTMuODk4LTIuNTY1LTYuNTY0LTIuNTY1aC0xOC4yNzFjLTIuNjY0LDAtNC44NTQsMC44NTUtNi41NjcsMi41NjUgICAgYy0xLjcxNCwxLjcxNC0yLjU2OCwzLjkwNC0yLjU2OCw2LjU2N3YxNjQuNDU0YzAsMi42NjksMC44NTQsNC44NTMsMi41NjgsNi41N0MyMDUuMjc0LDM0Ni4zMTYsMjA3LjQ2NSwzNDcuMTcyLDIxMC4xMjksMzQ3LjE3MnogICAgIiBmaWxsPSIjZmY5Y2FlIi8+CgkJPHBhdGggZD0iTTI4My4yMiwzNDcuMTcyaDE4LjI2OGMyLjY2OSwwLDQuODU5LTAuODU1LDYuNTctMi41NjdjMS43MTEtMS43MTgsMi41NjItMy45MDEsMi41NjItNi41N1YxNzMuNTgxICAgIGMwLTIuNjYzLTAuODUyLTQuODUzLTIuNTYyLTYuNTY3Yy0xLjcxMS0xLjcwOS0zLjkwMS0yLjU2NS02LjU3LTIuNTY1SDI4My4yMmMtMi42NywwLTQuODUzLDAuODU1LTYuNTcxLDIuNTY1ICAgIGMtMS43MTEsMS43MTQtMi41NjYsMy45MDQtMi41NjYsNi41Njd2MTY0LjQ1NGMwLDIuNjY5LDAuODU1LDQuODUzLDIuNTY2LDYuNTdDMjc4LjM2NywzNDYuMzE2LDI4MC41NSwzNDcuMTcyLDI4My4yMiwzNDcuMTcyeiIgZmlsbD0iI2ZmOWNhZSIvPgoJPC9nPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+Cjwvc3ZnPgo=) no-repeat;\r\n}\r\n\r\n/* make nested grid have slightly darker bg take almost all space (need some to tell them apart) so items inside can have similar to external size+margin */\r\n.grid-stack > .grid-stack-item.grid-stack-sub-grid > .grid-stack-item-content {\r\n  background: rgba(0,0,0,0.1);\r\n  inset: 0 2px;\r\n}\r\n.grid-stack.grid-stack-nested {\r\n  background: none;\r\n  inset: 0;\r\n}\r\n\r\n.grid-stack.show-dimensions .grid-stack-item:after {\r\n   content: '1x1';\r\n   position: absolute;\r\n   top: 50%;\r\n   left: 50%;\r\n   transform: translate(-50%, -50%);\r\n   padding: 2px;\r\n   color: black;\r\n   background-color: white;\r\n   pointer-events: none; /* to not interfere with dragging the item */\r\n}\r\n\r\n.grid-stack.show-dimensions .grid-stack-item[gs-h]::after {\r\n   content: '1x' attr(gs-h);\r\n}\r\n\r\n.grid-stack.show-dimensions .grid-stack-item[gs-w]::after {\r\n   content: attr(gs-w) 'x1';\r\n}\r\n\r\n.grid-stack.show-dimensions .grid-stack-item[gs-h][gs-w]::after {\r\n   content: attr(gs-w) 'x' attr(gs-h);\r\n}\r\n"
  },
  {
    "path": "demo/esmodule.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>ES Module demo</title>\n\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n\n</head>\n<body>\n  <h1>ES Module loading demo</h1>\n  <div class=\"grid-stack\"></div>\n\n  <!-- loading GS as an ES module instead of commonjs all.js. doesn't work (see #2476) and get CORS error locally -->\n  <script type=\"module\">\n    import { GridStack } from '../dist/gridstack.js';\n\n    let items = [{x: 1, y: 1}, {x: 2, y: 2, w: 3}];\n    let count = 0;\n    items.forEach(e => e.content = String(count++));\n\n    GridStack.init({float: true}).load(items);\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/events.js",
    "content": "function addEvents(grid, id) {\r\n  let g = (id !== undefined ? 'grid' + id : '');\r\n\r\n  grid.on('added removed change', function(event, items) {\r\n    let str = '';\r\n    items.forEach(function(item) { str += ' (' + item.x + ',' + item.y + ' ' + item.w + 'x' + item.h + ')'; });\r\n    console.log((g || items[0].grid.opts.id) + ' ' + event.type + ' ' + items.length + ' items (x,y w h):' + str );\r\n  })\r\n  .on('enable', function(event) {\r\n    let el = event.target;\r\n    console.log((g || el.gridstackNode.grid.opts.id) + ' enable');\r\n  })\r\n  .on('disable', function(event) {\r\n    let el = event.target;\r\n    console.log((g || el.gridstackNode.grid.opts.id) + ' disable');\r\n  })\r\n  .on('dragstart', function(event, el) {\r\n    let n = el.gridstackNode;\r\n    let x = el.getAttribute('gs-x'); // verify node (easiest) and attr are the same\r\n    let y = el.getAttribute('gs-y');\r\n    console.log((g || el.gridstackNode.grid.opts.id) + ' dragstart ' + (n.content || '') + ' pos: (' + n.x + ',' + n.y + ') = (' + x + ',' + y + ')');\r\n  })\r\n  .on('drag', function(event, el) {\r\n    let n = el.gridstackNode;\r\n    let x = el.getAttribute('gs-x'); // verify node (easiest) and attr are the same\r\n    let y = el.getAttribute('gs-y');\r\n    // console.log((g || el.gridstackNode.grid.opts.id) + ' drag ' + (n.content || '') + ' pos: (' + n.x + ',' + n.y + ') = (' + x + ',' + y + ')');\r\n  })\r\n  .on('dragstop', function(event, el) {\r\n    let n = el.gridstackNode;\r\n    let x = el.getAttribute('gs-x'); // verify node (easiest) and attr are the same\r\n    let y = el.getAttribute('gs-y');\r\n    console.log((g || el.gridstackNode.grid.opts.id) + ' dragstop ' + (n.content || '') + ' pos: (' + n.x + ',' + n.y + ') = (' + x + ',' + y + ')');\r\n  })\r\n  .on('dropped', function(event, previousNode, newNode) {\r\n    if (previousNode) {\r\n      console.log((g || previousNode.grid.opts.id) + ' dropped - Removed widget from grid:', previousNode);\r\n    }\r\n    if (newNode) {\r\n      console.log((g || newNode.grid.opts.id) + ' dropped - Added widget in grid:', newNode);\r\n    }\r\n  })\r\n  .on('resizestart', function(event, el) {\r\n    let n = el.gridstackNode;\r\n    let rec = el.getBoundingClientRect();\r\n    console.log(`${g || el.gridstackNode.grid.opts.id} resizestart ${n.content || ''} size: (${n.w}x${n.h}) = (${Math.round(rec.width)}x${Math.round(rec.height)})px`);\r\n\r\n  })\r\n  .on('resize', function(event, el) {\r\n    let n = el.gridstackNode;\r\n    let rec = el.getBoundingClientRect();\r\n    console.log(`${g || el.gridstackNode.grid.opts.id} resize ${n.content || ''} size: (${n.w}x${n.h}) = (${Math.round(rec.width)}x${Math.round(rec.height)})px`);\r\n  })\r\n  .on('resizestop', function(event, el) {\r\n    let n = el.gridstackNode;\r\n    let rec = el.getBoundingClientRect();\r\n    console.log(`${g || el.gridstackNode.grid.opts.id} resizestop ${n.content || ''} size: (${n.w}x${n.h}) = (${Math.round(rec.width)}x${Math.round(rec.height)})px`);\r\n  });\r\n}"
  },
  {
    "path": "demo/float.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Float grid demo</title>\n\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <script src=\"../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Float grid demo</h1>\n    <div>\n      <a class=\"btn btn-primary\" onClick=\"addNewWidget()\" href=\"#\">Add Widget</a>\n      <a class=\"btn btn-primary\" onClick=\"makeNewWidget()\" href=\"#\">Make Widget</a>\n      <a class=\"btn btn-primary\" onclick=\"toggleFloat()\" id=\"float\" href=\"#\">float: true</a>\n    </div>\n    <br><br>\n    <div class=\"grid-stack\"></div>\n  </div>\n  <script src=\"events.js\"></script>\n  <script type=\"text/javascript\">\n    let grid = GridStack.init({\n      float: true, \n      // disableResize: true, // TEST no resizing, but dragging\n      resizable: { handles: 'all'} // do all sides for testing\n    });\n    addEvents(grid);\n\n    let items = [\n      {x: 1, y: 1}, //, locked:true, content:\"locked\"},\n      {x: 2, y: 2, w: 3},\n      {x: 4, y: 2},\n      {x: 3, y: 1, h: 2},\n      {x: 0, y: 6, w: 2, h: 2}\n    ];\n    let count = 0;\n\n    getNode = function() {\n      let n = items[count] || {\n        x: Math.round(12 * Math.random()),\n        y: Math.round(5 * Math.random()),\n        w: Math.round(1 + 3 * Math.random()),\n        h: Math.round(1 + 3 * Math.random())\n      };\n      n.content = n.content || String(count);\n      count++;\n      return n;\n    };\n\n    addNewWidget = function() {\n      let w = grid.addWidget(getNode());\n    };\n\n    makeNewWidget = function() {\n      let n = getNode();\n      let doc = document.implementation.createHTMLDocument();\n      doc.body.innerHTML = `<div class=\"item\" gs-x=\"${n.x}\" gs-y=\"${n.y}\" gs-w=\"${n.w || 1}\" gs-h=\"${n.h || 1}\"><div class=\"grid-stack-item-content\">${n.content}</div></div>`;\n      let el = doc.body.children[0];\n      grid.el.appendChild(el);\n      // example showing when DOM is created elsewhere (eg Angular/Vue/React) and GS is used to convert to a widget\n      let w = grid.makeWidget(el);\n    };\n\n    toggleFloat = function() {\n      grid.float(! grid.getFloat());\n      document.querySelector('#float').innerHTML = 'float: ' + grid.getFloat();\n    };\n    addNewWidget();\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/index.html",
    "content": "<!DOCTYPE html>\n<html>\n\n<head>\n  <meta charset=\"utf-8\">\n  <title>Demo</title>\n</head>\n\n<body>\n  <h1>Demos</h1>\n  <ul>\n    <li><a href=\"anijs.html\">AniJS</a></li>\n    <li><a href=\"cell-height.html\">Cell Height</a></li>\n    <li><a href=\"column.html\">Column</a></li>\n    <li><a href=\"css_attributes.html\">CSS & attributes</a></li>\n    <!-- <li><a href=\"esmodule.html\">ES Module test</a></li> -->\n    <li><a href=\"float.html\">Float grid</a></li>\n    <li><a href=\"knockout.html\">Knockout.js</a></li>\n    <li><a href=\"lazy_load.html\">Lazy Load</a></li>\n    <li><a href=\"mobile.html\">Mobile touch</a></li>\n    <li><a href=\"nested.html\">Nested grids</a></li>\n    <li><a href=\"nested_advanced.html\">Nested Advanced grids</a></li>\n    <li><a href=\"nested_constraint.html\">Nested Constraint grids</a></li>\n    <li><a href=\"react-hooks-controlled-multiple.html\">ReactJS (Hooks), multiple grid, controlled (NOT Ideal)</a></li>\n    <li><a href=\"react-hooks.html\">ReactJS (Hooks)</a></li>\n    <li><a href=\"react.html\">ReactJS</a></li>\n    <li><a href=\"responsive.html\">Responsive: by column size</a></li>\n    <li><a href=\"responsive_break.html\">Responsive: using breakpoints</a></li>\n    <li><a href=\"responsive_none.html\">Responsive: using layout:'none'</a></li>\n    <li><a href=\"right-to-left(rtl).html\">Right-To-Left (RTL)</a></li>\n    <li><a href=\"serialization.html\">Serialization</a></li>\n    <li><a href=\"sizeToContent.html\">Size To Content</a></li>\n    <li><a href=\"static.html\">Static</a></li>\n    <li><a href=\"title_drag.html\">Title drag</a></li>\n    <li><a href=\"transform.html\">Transform (scale+offset)</a></li>\n    <li><a href=\"two.html\">Two grids</a></li>\n    <li><a href=\"two_vertical.html\">Two grids Vertical</a></li>\n    <li><a href=\"vue2js.html\">Vue2.js</a></li>\n    <li><a href=\"vue3js.html\">Vue3.js</a></li>\n    <li><a href=\"vue3js_dynamic-render_grid-item-content.html\">Vue3: Gridstack Controls Vue Rendering Grid Item Content</a></li>\n    <li><a href=\"vue3js_dynamic-render_grid-item.html\">Vue3: Gridstack Controls Vue Rendering Grid Item</a></li>\n    <li><a href=\"vue3js_v-for.html\">Vue3 with v-for</a></li>\n    <li><a href=\"vue3js_dynamic-modern-renderCB.html\">Vue3: Render GridStack item content using GridStack.renderCB</a></li>\n    <li><a href=\"web-comp.html\">Web Component</a></li>\n    <li><a href=\"web1.html\">Website demo 1</a></li>\n    <li><a href=\"web2.html\">Website demo 2</a></li>\n  </ul>\n  <h1>Angular wrapper</h1>\n  <p>We now ship an <a href=\"https://github.com/gridstack/gridstack.js/tree/master/angular/\" target=\"_blank\">Angular Component</a>\n    to make it supper easy for that framework</p>\n  <h1>React wrapper</h1>\n  <p>React original examples are shown above, but upcoming and better TS based <a href=\"https://github.com/gridstack/gridstack.js/tree/master/react/\" target=\"_blank\">/react</a> folder (working to make that official and ship it) should be looked at instead. </p>\n  <h1>Old v5.1.1 Jquery Demos</h1>\n  Note: those are no longer supported, and use an old version of the lib to compare functionality.\n  <ul>\n    <li><a href=\"old_two-jq.html\">Two grids</a></li>\n    <li><a href=\"old_nested-jq.html\">Nested grids</a></li>\n  </ul>\n</body>\n\n</html>\n"
  },
  {
    "path": "demo/knockout.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Knockout.js demo</title>\n\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n\n  <script src=\"https://cdnjs.cloudflare.com/ajax/libs/knockout/3.5.0/knockout-debug.js\"></script>\n  <script src=\"../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>knockout.js Demo</h1>\n    <div>\n      <a class=\"btn btn-primary\" data-bind=\"click: addNewWidget\">Add Widget</a>\n    </div>\n    <br>\n    <div data-bind=\"component: {name: 'dashboard-grid', params: $data}\"></div>\n  </div>\n\n  <script type=\"text/javascript\">\n    ko.components.register('dashboard-grid', {\n      viewModel: {\n        createViewModel: function (controller, componentInfo) {\n          let ViewModel = function (controller, componentInfo) {\n            let grid = null;\n\n            this.widgets = controller.widgets;\n\n            this.afterAddWidget = function (items) {\n              if (!grid ) {\n                grid = GridStack.init({auto: false});\n              }\n\n              let item = items.find(function (i) { return i.nodeType == 1 });\n              grid.makeWidget(item);\n              ko.utils.domNodeDisposal.addDisposeCallback(item, function () {\n                grid.removeWidget(item);\n              });\n            };\n          };\n\n          return new ViewModel(controller, componentInfo);\n        }\n      },\n      template:\n        [\n          '<div class=\"grid-stack\" data-bind=\"foreach: {data: widgets, afterRender: afterAddWidget}\">',\n          '   <div class=\"grid-stack-item\" data-bind=\"attr: {\\'gs-x\\': $data.x, \\'gs-y\\': $data.y, \\'gs-w\\': $data.w, \\'gs-h\\': $data.h, \\'gs-auto-position\\': $data.auto_position, \\'gs-id\\': $data.id}\">',\n          '     <div class=\"grid-stack-item-content\"><button data-bind=\"click: $root.deleteWidget\">Delete me</button></div>',\n          '   </div>',\n          '</div> '\n        ].join('')\n    });\n\n    let Controller = function (widgets) {\n      let self = this;\n\n      this.widgets = ko.observableArray(widgets);\n\n      this.addNewWidget = function () {\n        this.widgets.push({\n          x: 0,\n          y: 0,\n          w: Math.floor(1 + 3 * Math.random()),\n          h: Math.floor(1 + 3 * Math.random()),\n          auto_position: true\n        });\n        return false;\n      };\n\n      this.deleteWidget = function (item) {\n        self.widgets.remove(item);\n        return false;\n      };\n    };\n\n    let widgets = [\n      {x: 0, y: 0, w: 2, h: 2, id: '0'},\n      {x: 2, y: 0, w: 4, h: 2, id: '1'},\n      {x: 6, y: 0, w: 2, h: 4, id: '2'},\n      {x: 1, y: 2, w: 4, h: 2, id: '3'}\n    ];\n\n    let controller = new Controller(widgets);\n    ko.applyBindings(controller);\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/lazy_load.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Lazy loading demo</title>\n\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <script src=\"../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <div>\n    <h1>Lazy loading + renderCB demo</h1>\n    <p>New V11 GridStackWidget.lazyLoad feature. open console and see widget content (or angular components) created as they become visible.</p>\n    <div style=\"height: 300px; overflow-y: auto\">\n      <div class=\"grid-stack\"></div>\n    </div>\n  </div>\n  <script type=\"text/javascript\">\n    // print when widgets are created, verify dragging by newly added content\n    GridStack.renderCB = function(el, w) {\n      const title = document.createElement('h3');\n      title.textContent = 'Drag me by title';\n      title.className = 'card-header';\n      el.appendChild(title);\n      const div = document.createElement('div');\n      div.textContent = w.id;\n      el.appendChild(div);\n      console.log('created node id ', w.id);\n    };\n\n    let children = [];\n    for (let y = 0; y <= 5; y++) children.push({x:0, y, id:String(y), content: String(y)});\n    \n    let grid = GridStack.init({\n      cellHeight: 200,\n      children,\n      lazyLoad: true,  // delay creation until visible\n      handle: '.card-header',\n    });\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/locked.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Locked demo</title>\n\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <script src=\"../dist/gridstack-all.js\"></script>\n  </style>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Locked demo</h1>\n    <div>\n      <a class=\"btn btn-primary\" onClick=\"addNewWidget()\" href=\"#\">Add Widget</a>\n      <a class=\"btn btn-primary\" onclick=\"toggleFloat()\" id=\"float\" href=\"#\">float: true</a>\n    </div>\n    <br><br>\n    <div class=\"grid-stack\"></div>\n  </div>\n\n  <script type=\"text/javascript\">\n    let grid = GridStack.init({float: true});\n\n    grid.on('added removed change', function(e, items) {\n      let str = '';\n      items.forEach(function(item) { str += ' (x,y)=' + item.x + ',' + item.y; });\n      console.log(e.type + ' ' + items.length + ' items:' + str );\n    });\n\n    let items = [\n      {x: 0, y: 1, w: 12, locked: 'yes', noMove: true, noResize: true, text: 'locked, noResize, noMove'},\n      {x: 1, y: 0, w: 2, h: 3},\n      {x: 4, y: 2},\n      {x: 3, y: 1, h: 2},\n      {x: 0, y: 6, w: 2, h: 2}\n    ];\n    let count = 0;\n\n    addNewWidget = function() {\n      let n = items[count] || {\n        x: Math.round(12 * Math.random()),\n        y: Math.round(5 * Math.random()),\n        w: Math.round(1 + 3 * Math.random()),\n        h: Math.round(1 + 3 * Math.random())\n      };\n      n.content = n.text ? n.text : String(count);\n      grid.addWidget(n);\n      count++\n    };\n\n    toggleFloat = function() {\n      grid.float(! grid.float());\n      document.querySelector('#float').innerHTML = 'float: ' + grid.float();\n    };\n    addNewWidget();\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/mobile.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Simple mobile demo</title>\n\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <script src=\"../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <h1>Simple mobile demo</h1>\n  <p>shows resize handle on mobile and support native touch events</p>\n  <div class=\"grid-stack\"></div>\n  <script type=\"text/javascript\">\n    let grid = GridStack.init({\n      column: 3,\n    });\n    grid.load([{x:0, y:0, content: '1'}, {x:1, y:0, h:2, content: '2'}, {x:2, y:0, content: '3'}])\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/nested.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Nested grids demo</title>\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <script src=\"../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Nested grids demo</h1>\n    <p>This example shows v5.x dragging between nested grids (dark yellow) and parent grid (bright yellow.)<br>\n      Use v9.2 <b>sizeToContent:true</b> on first subgrid item parent to grow/shrink as needed, while leaving leaf green items unchanged.<br>\n      Uses v3.1 API to load the entire nested grid from JSON.<br>\n      Nested grids uses v5 <b>column:'auto'</b> to keep items same size during resize.</p>\n    <div class=\"actions\" style=\"display: flex; flex-direction: row; gap: 5px;\">\n      <a class=\"btn btn-primary\" onClick=\"addWidget()\" href=\"#\">Add Widget</a>\n      <a class=\"btn btn-primary\" onClick=\"addNewWidget('.sub1')\" href=\"#\">Add Widget Grid1</a>\n      <a class=\"btn btn-primary\" onClick=\"addNewWidget('.sub2')\" href=\"#\">Add Widget Grid2</a>\n      <a class=\"btn btn-primary\" onClick=\"addNested()\" href=\"#\">Add Nested Grid</a>\n      <!-- add .grid-stack-item for acceptWidgets:true -->\n      <div class=\"sidebar-item grid-stack-item\">Drag nested</div>\n    </div>\n    <br />\n    <div>\n      <span>Grid Mode: </span>\n      <input type=\"radio\" id=\"static\" name=\"mode\" value=\"true\" onClick=\"setStatic(true)\"><label for=\"static\">static</label>\n      <input type=\"radio\" id=\"edit\" name=\"mode\" value=\"false\" checked onClick=\"setStatic(false)\"><label for=\"edit\">editable</label>\n    </div>\n    <span>entire save/re-create:</span>\n    <a class=\"btn btn-primary\" onClick=\"save()\" href=\"#\">Save</a>\n    <a class=\"btn btn-primary\" onClick=\"destroy()\" href=\"#\">Destroy</a>\n    <a class=\"btn btn-primary\" onClick=\"load()\" href=\"#\">Create</a>\n    <span>partial save/load:</span>\n    <a class=\"btn btn-primary\" onClick=\"save(true, false)\" href=\"#\">Save list</a>\n    <a class=\"btn btn-primary\" onClick=\"save(false, false)\" href=\"#\">Save no content</a>\n    <a class=\"btn btn-primary\" onClick=\"destroy(false)\" href=\"#\">Clear</a>\n    <a class=\"btn btn-primary\" onClick=\"load(false)\" href=\"#\">Load</a>\n    <br><br>\n    <!-- grid will be added here -->\n  </div>\n  <script src=\"events.js\"></script>\n  <script type=\"text/javascript\">\n    // NOTE: REAL apps would sanitize-html or DOMPurify before blinding setting innerHTML. see #2736\n    GridStack.renderCB = function(el, w) {\n      if (w.content) el.innerHTML = w.content;\n    };\n\n    let staticGrid = false;\n    let sub1 = [ {x:0, y:0}, {x:1, y:0}, {x:2, y:0}, {x:3, y:0}, {x:0, y:1}, {x:1, y:1}];\n    let sub2 = [ {x:0, y:0, h:2}, {x:1, y:1, w:2}];\n    let count = 0;\n    [...sub1, ...sub2].forEach(d => d.content = String(count++));\n    let options = { // main grid options\n      staticGrid, // test - force children to inherit too if we set to true above ^^^\n      // disableDrag: true,\n      // disableResize: true,\n      cellHeight: 50,\n      margin: 5,\n      minRow: 2, // don't collapse when empty\n      acceptWidgets: true,\n      id: 'main',\n      resizable: { handles: 'se,e,s,sw,w'},\n      // subGridOpts, // options for all subgrids, but defaults to column='auto' now so no need.\n      children: [\n        {x:0, y:0, content: 'regular item'},\n        {x:1, y:0, w:4, h:4, sizeToContent: true, content: '<div>nested grid sizeToContent:true with some header content</div>', subGridOpts: {children: sub1, id:'sub1_grid', class: 'sub1'}},\n        {x:5, y:0, w:3, h:4, subGridOpts: {children: sub2, id:'sub2_grid', class: 'sub2'}},\n      ]\n    };\n\n    // create and load it all from JSON above\n    let grid = GridStack.addGrid(document.querySelector('.container-fluid'), options);\n\n    // add debug event handlers to main grid (new v12.1 handles sub-grids too)\n    addEvents(grid);\n\n    // setup drag drop behavior\n    let sidebarContent = [\n     { w:2, h:2, subGridOpts: { children: [{content: 'nest 1'}, {content: 'nest 2'}]}}\n    ];\n    GridStack.setupDragIn('.sidebar-item', undefined, sidebarContent);\n\n    function setStatic(val) {\n      staticGrid = val;\n      grid.setStatic(staticGrid);\n    }\n\n    function addWidget() {\n      grid.addWidget({x:0, y:100, content:\"new item\"});\n    }\n\n    function addNested() {\n      grid.addWidget({x:0, y:100, sizeToContent: true, subGridOpts: {\n        children: [ {content: 'hello'}, {y:1, content: 'world'}],\n        ...subOptions}\n      });\n    }\n\n    function addNewWidget(selector) {\n      let subGrid = document.querySelector(selector).gridstack;\n      let node = {\n        x: Math.round(6 * Math.random()),\n        y: Math.round(5 * Math.random()),\n        w: Math.round(1 + 1 * Math.random()),\n        h: Math.round(1 + 1 * Math.random()),\n        content: String(count++)\n      };\n      subGrid.addWidget(node);\n      return false;\n    };\n\n    //--- end of Drag and Drop Nested widget logic\n\n    function save(content = true, full = true) {\n      options = grid.save(content, full);\n      console.log(options);\n      // console.log(JSON.stringify(options));\n    }\n    function destroy(full = true) {\n      if (full) {\n        grid.off('dropped');\n        grid.destroy();\n        grid = undefined;\n      } else {\n        grid.removeAll();\n      }\n    }\n    function load(full = true) {\n      if (full) {\n        grid = GridStack.addGrid(document.querySelector('.container-fluid'), options);\n      } else {\n        grid.load(options);\n      }\n    }\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/nested_advanced.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Advance Nested grids demo</title>\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <!-- test using CSS rather than minRow -->\n  <style type=\"text/css\">\n    .container-fluid > .grid-stack { min-height: 250px}\n  </style>\n  <script src=\"../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Advanced Nested grids demo</h1>\n    <p>Create sub-grids (darker background) on the fly, by dragging items completely over others (nest) vs partially (push) using\n      the new v7 API <code>GridStackOptions.subGridDynamic=true</code></p>\n    <p>This will use the new delay drag&drop option <code>DDDragOpt.pause</code> to tell the gesture difference</p>\n    <a class=\"btn btn-primary\" onClick=\"addMainWidget()\" href=\"#\">Add Widget</a>\n    <a class=\"btn btn-primary\" onClick=\"addNewWidget(0)\" href=\"#\">Add W Grid0</a>\n    <a class=\"btn btn-primary\" onClick=\"addNewWidget(1)\" href=\"#\">Add W Grid1</a>\n    <a class=\"btn btn-primary\" onClick=\"addNewWidget(2)\" href=\"#\">Add W Grid2</a>\n    <span>entire option+layout:</span>\n    <a class=\"btn btn-primary\" onClick=\"save()\" href=\"#\">Save Full</a>\n    <a class=\"btn btn-primary\" onClick=\"destroy()\" href=\"#\">Destroy</a>\n    <a class=\"btn btn-primary\" onClick=\"load()\" href=\"#\">Re-create</a>\n    <span>layout list:</span>\n    <a class=\"btn btn-primary\" onClick=\"save(true, false)\" href=\"#\">Save layout</a>\n    <a class=\"btn btn-primary\" onClick=\"save(false, false)\" href=\"#\">Save layout no content</a>\n    <a class=\"btn btn-primary\" onClick=\"destroy(false)\" href=\"#\">Clear</a>\n    <a class=\"btn btn-primary\" onClick=\"load(false)\" href=\"#\">Load</a>\n    <br><br>\n    <!-- grid will be added here -->\n  </div>\n  <p>Output</p>\n  <textarea id=\"saved\" style=\"width:100%; height:200px;\"></textarea>\n  <script type=\"text/javascript\">\n    let subOptions = {\n      cellHeight: 50, // should be 50 - top/bottom\n      column: 'auto', // size to match container\n      acceptWidgets: true, // will accept .grid-stack-item by default\n      margin: 5,\n      subGridDynamic: true, // make it recursive for all future sub-grids\n    };\n    let main = [{x:0, y:0}, {x:0, y:1}, {x:1, y:0}]\n    let sub1 = [{x:0, y:0}];\n    let sub0 = [{x:0, y:0}, {x:1, y:0}];\n    // let sub0 = [{x:0, y:0}, {x:1, y:0}, {x:1, y:1, h:2, subGridOpts: {children: sub1, ...subOptions}}];\n    let options = { // main grid options\n      cellHeight: 50,\n      margin: 5,\n      minRow: 2, // don't collapse when empty\n      acceptWidgets: true,\n      subGridOpts: subOptions,\n      subGridDynamic: true, // v7 api to create sub-grids on the fly\n      children: [\n        ...main,\n        {x:2, y:0, w:2, h:3, id: 'sub0', subGridOpts: {children: sub0, ...subOptions}},\n        {x:4, y:0, h:2, id: 'sub1', subGridOpts: {children: sub1, ...subOptions}},\n        // {x:2, y:0, w:2, h:3, subGridOpts: {children: [...sub1, {x:0, y:1, subGridOpts: subOptions}], ...subOptions}/*,content: \"<div>nested grid here</div>\"*/},\n      ]\n    };\n    let count = 0;\n    // create unique ids+content so we can incrementally load() and not re-create anything (updates)\n    [...main, ...sub0, ...sub1].forEach(d => d.id = d.content = String(count++));\n\n    // create and load it all from JSON above\n    document.querySelector('#saved').value = JSON.stringify(options);\n    let grid = GridStack.addGrid(document.querySelector('.container-fluid'), options);\n\n    function addMainWidget() {\n      grid.addWidget({x:0, y:100, content:\"new item\"});\n    }\n\n    function addNewWidget(i) {\n      let subGrid = document.querySelectorAll('.grid-stack-nested')[i]?.gridstack;\n      if (!subGrid) return;\n      let node = {\n        // x: Math.round(6 * Math.random()),\n        // y: Math.round(5 * Math.random()),\n        // w: Math.round(1 + 1 * Math.random()),\n        // h: Math.round(1 + 1 * Math.random()),\n        content: String(count++)\n      };\n      subGrid.addWidget(node);\n      return false;\n    };\n\n    function save(content = true, full = true) {\n      options = grid?.save(content, full);\n      console.log(options);\n      document.querySelector('#saved').value = JSON.stringify(options);\n    }\n    function destroy(full = true) {\n      if (!grid) return;\n      if (full) {\n        grid.destroy();\n        grid = undefined;\n      } else {\n        grid.removeAll();\n      }\n    }\n    function load(full = true) {\n      // destroy(full); // in case user didn't call\n      if (full || !grid) {\n        grid = GridStack.addGrid(document.querySelector('.container-fluid'), options);\n      } else {\n        grid.load(options);\n      }\n    }\n\n    // save(true, false); load(false); // TESTing\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/nested_constraint.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Constraint nested grids demo</title>\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <script src=\"../dist/gridstack-all.js\"></script>\n  <style type=\"text/css\">\n    .grid-stack-item.sub .grid-stack-item-content {\n      background: lightpink;\n    }\n  </style>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Constraint Nested grids demo</h1>\n    <p>This example shows sub-grids only accepting pink items, while parent accept all.</p>\n    <a class=\"btn btn-primary\" onClick=\"addNested()\" href=\"#\">Add Widget</a>\n    <a class=\"btn btn-primary\" onClick=\"addNewWidget('.sub1')\" href=\"#\">Add Widget Grid1</a>\n    <a class=\"btn btn-primary\" onClick=\"addNewWidget('.sub2')\" href=\"#\">Add Widget Grid2</a>\n    <span>entire save/re-create:</span>\n    <a class=\"btn btn-primary\" onClick=\"save()\" href=\"#\">Save</a>\n    <a class=\"btn btn-primary\" onClick=\"destroy()\" href=\"#\">Destroy</a>\n    <a class=\"btn btn-primary\" onClick=\"load()\" href=\"#\">Create</a>\n    <span>partial save/load:</span>\n    <a class=\"btn btn-primary\" onClick=\"save(true, false)\" href=\"#\">Save list</a>\n    <a class=\"btn btn-primary\" onClick=\"save(false, false)\" href=\"#\">Save no content</a>\n    <a class=\"btn btn-primary\" onClick=\"destroy(false)\" href=\"#\">Clear</a>\n    <a class=\"btn btn-primary\" onClick=\"load(false)\" href=\"#\">Load</a>\n    <br><br>\n    <!-- grid will be added here -->\n  </div>\n\n  <script type=\"text/javascript\">\n    let sub1 = [ {x:0, y:0}, {x:1, y:0}, {x:2, y:0}, {x:3, y:0}, {x:0, y:1}, {x:1, y:1}];\n    let sub2 = [ {x:0, y:0}, {x:0, y:1, w:2}];\n    let count = 0;\n    [...sub1, ...sub2].forEach(d => d.content = String(count++));\n    let subOptions = {\n      cellHeight: 50,\n      column: 'auto', // size to match container\n      itemClass: 'sub', // style sub items differently and use to prevent dragging in/out\n      acceptWidgets: '.grid-stack-item.sub', // only pink sub items can be inserted\n      margin: 2,\n      minRow: 1, // don't collapse when empty\n    };\n    let options = { // main grid options\n      cellHeight: 50,\n      margin: 5,\n      minRow: 2, // don't collapse when empty\n      acceptWidgets: true,\n      id: 'main',\n      children: [\n        {y:0, content: 'regular item'},\n        {x:1, w:4, h:4, subGridOpts: {children: sub1, class: 'sub1', ...subOptions}},\n        {x:5, w:4, h:4, subGridOpts: {children: sub2, class: 'sub2', ...subOptions}},\n      ]\n    };\n\n    // create and load it all from JSON above\n    let grid = GridStack.addGrid(document.querySelector('.container-fluid'), options);\n\n    addNested = function() {\n      grid.addWidget({x:0, y:100, content:\"new item\"});\n    }\n\n    addNewWidget = function(selector) {\n      let subGrid = document.querySelector(selector).gridstack;\n      let node = {\n        x: Math.round(6 * Math.random()),\n        y: Math.round(5 * Math.random()),\n        w: Math.round(1 + 1 * Math.random()),\n        h: Math.round(1 + 1 * Math.random()),\n        content: String(count++)\n      };\n      subGrid.addWidget(node);\n      return false;\n    };\n\n    save = function(content = true, full = true) {\n      options = grid.save(content, full);\n      console.log(options);\n      // console.log(JSON.stringify(options));\n    }\n    destroy = function(full = true) {\n      if (full) {\n        grid.destroy();\n        grid = undefined;\n      } else {\n        grid.removeAll();\n      }\n    }\n    load = function(full = true) {\n      if (full) {\n        grid = GridStack.addGrid(document.querySelector('.container-fluid'), options);\n      } else {\n        grid.load(options);\n      }\n    }\n\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/old_nested-jq.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Nested JQuery grids demo (old v5.1.1) which never worked fully</title>\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <script src=\"https://cdn.jsdelivr.net/npm/gridstack@5.1.1/dist/gridstack-jq.js\"></script>\n  <style type=\"text/css\">\n    /* make nested grids have slightly darker bg */\n    .grid-stack.grid-stack-nested {\n      background: #e4e4c1;\n    }\n    /* make nested grid take almost all space (need some to tell them apart) so items inside can have similar to external size+margin */\n    .grid-stack > .grid-stack-item.grid-stack-nested > .grid-stack-item-content {\n      /* inset: 0 2px; not IE */\n      top: 0;\n      bottom: 0;\n      left: 2px;\n      right: 2px;\n    }\n    /* make nested grid take entire item content */\n    .grid-stack-item-content .grid-stack {\n      min-height: 100%;\n      min-width: 100%;\n    }\n  </style>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Nested JQuery grids demo</h1>\n    <p>This is the same nested grid demo, but for Jquery which has additional work required, and options.<br>\n      1. dragOut is implemented (second subgrid cannot drag outside, only adding item).<br>\n    </p>\n    <a class=\"btn btn-primary\" onClick=\"addNested()\" href=\"#\">Add Widget</a>\n    <a class=\"btn btn-primary\" onClick=\"addNewWidget('.sub1')\" href=\"#\">Add Widget Grid1</a>\n    <a class=\"btn btn-primary\" onClick=\"addNewWidget('.sub2')\" href=\"#\">Add Widget Grid2</a>\n    <span>entire save/re-create:</span>\n    <a class=\"btn btn-primary\" onClick=\"save()\" href=\"#\">Save</a>\n    <a class=\"btn btn-primary\" onClick=\"destroy()\" href=\"#\">Destroy</a>\n    <a class=\"btn btn-primary\" onClick=\"load()\" href=\"#\">Create</a>\n    <span>partial save/load:</span>\n    <a class=\"btn btn-primary\" onClick=\"save(true, false)\" href=\"#\">Save list</a>\n    <a class=\"btn btn-primary\" onClick=\"save(false, false)\" href=\"#\">Save no content</a>\n    <a class=\"btn btn-primary\" onClick=\"destroy(false)\" href=\"#\">Clear</a>\n    <a class=\"btn btn-primary\" onClick=\"load(false)\" href=\"#\">Load</a>\n    <br><br>\n    <!-- grid will be added here -->\n  </div>\n\n  <script type=\"text/javascript\">\n    let sub1 = [ {x:0, y:0}, {x:1, y:0}, {x:2, y:0}, {x:3, y:0}, {x:0, y:1}, {x:1, y:1}];\n    let sub2 = [ {x:0, y:0}, {x:0, y:1, w:2}];\n    let count = 0;\n    [...sub1, ...sub2].forEach(d => d.content = String(count++));\n    let subOptions = {\n      cellHeight: 50, // should be 50 - top/bottom\n      column: 'auto', // size to match container\n      acceptWidgets: true, // will accept .grid-stack-item by default\n      margin: 5,\n      draggable: {\n        scroll: false,\n        appendTo: 'body',\n        helper: myClone,\n        // handle: \".grid-stack-item\"\n        // zIndex: true,\n      }\n    };\n    let options = { // main grid options\n      cellHeight: 50,\n      margin: 5,\n      minRow: 2, // don't collapse when empty\n      acceptWidgets: true,\n      id: 'main',\n      children: [\n        {x:0, y:0, content: 'regular item'},\n        {x:1, w:4, h:4, subGridOpts: {children: sub1, dragOut: true, class: 'sub1', ...subOptions}},\n        {x:5, w:3, h:4, subGridOpts: {children: sub2, dragOut: false, class: 'sub2', ...subOptions}},\n      ]\n    };\n\n    // create and load it all from JSON above\n    let grid = GridStack.addGrid(document.querySelector('.container-fluid'), options);\n\n    // WORK-IN_PROGRESS the target is content, but we need to drag the grid-item parent and jquery-ui needs helper\n    // to be different, and re-parented (so it doesn't get clipped by other containers overflow-x:hidden, overflow-y:auto which are needed behavior)\n    // but jq-ui doesn't support position:fixed\n    function myClone(event) {\n      let item = event.target.parentElement;\n      item = item.cloneNode(true);\n      grid.el.append(item)\n      // item.style.position = 'fixed'\n      return item;\n    }\n\n    function addNested() {\n      grid.addWidget({x:0, y:100, content:\"new item\"});\n    }\n\n    function addNewWidget(selector) {\n      let subGrid = document.querySelector(selector).gridstack;\n      let node = {\n        x: Math.round(6 * Math.random()),\n        y: Math.round(5 * Math.random()),\n        w: Math.round(1 + 1 * Math.random()),\n        h: Math.round(1 + 1 * Math.random()),\n        content: String(count++)\n      };\n      subGrid.addWidget(node);\n      return false;\n    };\n\n    function save(content = true, full = true) {\n      options = grid.save(content, full);\n      console.log(options);\n      // console.log(JSON.stringify(options));\n    }\n    function destroy(full = true) {\n      if (full) {\n        grid.destroy();\n        grid = undefined;\n      } else {\n        grid.removeAll();\n      }\n    }\n    function load(full = true) {\n      if (full) {\n        grid = GridStack.addGrid(document.querySelector('.container-fluid'), options);\n      } else {\n        grid.load(options);\n      }\n    }\n\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/old_two-jq.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Two grids JQ demo</title>\n\n  <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css\">\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n\n  <script src=\"https://cdn.jsdelivr.net/npm/gridstack@5.1.1/dist/gridstack-jq.js\"></script>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Two grids demo (old v5.1.1 Jquery version)</h1>\n\n    <div class=\"row\">\n      <div class=\"col-md-3\">\n        <div class=\"sidebar\">\n          <!-- will size to match content -->\n          <div class=\"grid-stack-item\">\n            <div class=\"grid-stack-item-content\">Drag me</div>\n          </div>\n          <!-- manually force a drop size of 2x1 -->\n          <div class=\"grid-stack-item\" gs-w=\"2\" gs-h=\"1\" gs-max-w=\"3\">\n            <div class=\"grid-stack-item-content\">2x1, max=3</div>\n          </div>\n        </div>\n      </div>\n      <div class=\"col-md-9\">\n        <div class=\"trash\">\n        </div>\n      </div>\n    </div>\n\n    <div class=\"row\" style=\"margin-top: 20px\">\n      <div class=\"col-md-6\">\n        <a onClick=\"toggleFloat(this, 0)\" class=\"btn btn-primary\" href=\"#\">float: false</a>\n        <a onClick=\"compact(0)\" class=\"btn btn-primary\" href=\"#\">Compact</a>\n        <div class=\"grid-stack\"></div>\n      </div>\n      <div class=\"col-md-6\">\n        <a onClick=\"toggleFloat(this, 1)\" class=\"btn btn-primary\" href=\"#\">float: true</a>\n        <a onClick=\"compact(1)\" class=\"btn btn-primary\" href=\"#\">Compact</a>\n        <div class=\"grid-stack\"></div>\n      </div>\n    </div>\n  </div>\n  <script src=\"events.js\"></script>\n  <script type=\"text/javascript\">\n  let grids;\n  $(function () { // testing $ works (delay loading here)\n    let options = {\n      column: 6,\n      minRow: 1, // don't collapse when empty\n      cellHeight: 70,\n      float: false,\n      // dragIn: '.sidebar .grid-stack-item', // add draggable to class\n      // dragInOptions: { revert: 'invalid', scroll: false, appendTo: 'body', helper: 'clone' }, // clone\n      removable: '.trash', // true or drag-out delete class\n      acceptWidgets: function(el) { return true; } // function example, but can also be: true | false | '.someClass' value\n    };\n    let grids = GridStack.initAll(options);\n    grids[1].float(true);\n\n    // new 4.x static method instead of setting up options on every grid (never been per grid really) but old options still works\n    GridStack.setupDragIn('.sidebar .grid-stack-item', { revert: 'invalid', scroll: false, appendTo: 'body', helper: myClone });\n    // GridStack.setupDragIn(); // second call will now work (cache last values)\n\n    let items = [\n      {x: 0, y: 0, w: 2, h: 2},\n      {x: 3, y: 1, h: 2},\n      {x: 4, y: 1},\n      {x: 2, y: 3, w: 3, maxW: 3, id: 'special', content: 'has maxW=3'},\n      {x: 2, y: 5}\n    ];\n\n    grids.forEach(function (grid, i) {\n      addEvents(grid, i);\n      grid.load(items);\n    });\n  });\n\n    // decide what the dropped item will be - for now just a clone but can be anything\n    function myClone(event) {\n      return event.target.cloneNode(true);\n    }\n\n    function toggleFloat(button, i) {\n      grids[i].float(! grids[i].getFloat());\n      button.innerHTML = 'float: ' + grids[i].getFloat();\n    }\n\n    function compact(i) {\n      grids[i].compact();\n    }\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/react-hooks-controlled-multiple.html",
    "content": "<!DOCTYPE html>\n<html>\n\n<head>\n  <meta charset=\"UTF-8\" />\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  <title>Gridstack.js React integration example</title>\n  <link rel=\"stylesheet\" href=\"demo.css\" />\n  <script src=\"../dist/gridstack-all.js\"></script>\n\n  <!-- Scripts to use react inside html - DEVELOPMENT FILES -->\n  <script src=\"https://unpkg.com/react@16/umd/react.development.js\"></script>\n  <script src=\"https://unpkg.com/react-dom@16/umd/react-dom.development.js\"></script>\n  <script src=\"https://unpkg.com/babel-standalone@6.15.0/babel.js\"></script>\n</head>\n\n<body>\n  <div>\n    <h2>Controlled stack</h2>\n    <div id=\"controlled-stack\"></div>\n  </div>\n</body>\n\n<script type=\"text/babel\">\n  /***********************************************************************************************************/\n  /********************************* NOT IDEAL - see comments below line ~96) ********************************/\n  /***********************************************************************************************************/\n\n  const { useState, useEffect, useLayoutEffect, createRef, useRef } = React\n  const Item = ({ id }) => <div>{id}</div>\n\n  //\n  // Controlled example\n  //\n  const ControlledStack = ({ items, addItem, changeItems }) => {\n    const refs = useRef({})\n    const gridRef = useRef()\n    const gridContainerRef = useRef(null)\n    refs.current = {}\n\n    if (Object.keys(refs.current).length !== items.length) {\n      items.forEach(({ id }) => {\n        refs.current[id] = refs.current[id] || createRef()\n      })\n    }\n\n    useLayoutEffect(() => {\n      if (!gridRef.current) {\n        // no need to init twice (would will return same grid) or register dup events\n        const grid = gridRef.current = GridStack.init(\n          {\n            float: false,\n            acceptWidgets: true,\n            column: 6,\n            minRow: 1,\n          },\n          gridContainerRef.current\n        )\n        .on('added', (ev, gsItems) => {\n          if (grid._ignoreCB) return;\n          // remove the new element as React will re-create it again (dup) once we add to the list or we get 2 of them with same ids but different DOM el!\n          // TODO: this is really not ideal - we shouldn't mix React templating with GS making it own edits as those get out of sync! see comment below ~96.\n          gsItems.forEach(n => {\n            grid.removeWidget(n.el, true, false); // true=remove DOM, false=don't call use back!\n            // can't pass n directly even though similar structs as it has n.el.gridstackNode which gives JSON error for circular write.\n            addItem({id:n.id, x:n.x, y:n.y, w:n.w, h:n.h});\n          });\n        })\n        .on('removed change', (ev, gsItems) => {\n          // synch our version from GS....\n          // Note: we could just update those few items passed but save() is fast and it's easier to just set an entire new list\n          // and since we have the same ids, React will not re-create anything...\n          const newItems = grid.save(false); // saveContent=false\n          changeItems(newItems);\n        })\n        // addEvents(grid, i);\n      } else {\n        //\n        // update existing GS layout, which is optimized to updates only diffs and add new/delete items as well\n        //\n        const grid = gridRef.current;\n        const layout = items.map((a) => \n          // use exiting nodes (which will skip diffs being the same) else new elements Widget but passing the React dom .el so we know what to makeWidget() on!\n          refs.current[a.id].current.gridstackNode || {...a, el: refs.current[a.id].current}\n        );\n        grid._ignoreCB = true; // hack: ignore added/removed since we're the one doing the update\n        grid.load(layout);\n        delete grid._ignoreCB;\n      }\n\n    }, [items])\n\n    return (\n      // ********************\n      // NOTE: constructing DOM grid items in template when gridstack is also allowed creating (dragging between grids, or adding/removing from say a toolbar)\n      // is NOT A GOOD IDEA as you end up fighting between gridstack users' edits and your template items structure which are not in sync.\n      // At best, you end up re-creating widgets DOM (from React template) and all their content & state after a widget was inserted/re-parented by the user.\n      // a MUCH better way is to let GS create React components using it's API/user interactions, with only initial load() of a stored layout.\n      // See the Angular component wrapper that does that: https://github.com/gridstack/gridstack.js/tree/master/angular/ (lib author uses Angular)\n      // ...TBD creating React equivalent...\n      //\n      // Also templating forces you to spell out the 15+ GridStackWidget attributes (only x,y,w,h done below), instead of passing an option structure that \n      // supports everything, is not robust as things get added and pollutes the DOM attr for default/missing entries, vs the optimized code in GS.\n      // ********************\n      <div style={{ width: '100%', marginRight: '10px' }}>\n        <div className=\"grid-stack\" ref={gridContainerRef}>\n          {items.map((item, i) => {\n            return (\n              <div ref={refs.current[item.id]} key={item.id} className=\"grid-stack-item\" gs-id={item.id} gs-w={item.w} gs-h={item.h} gs-x={item.x} gs-y={item.y}>\n                <div className=\"grid-stack-item-content\">\n                  <Item {...item} />\n                </div>\n              </div>\n            )\n          })}\n        </div>\n        <code>\n          <pre>{JSON.stringify(items, null, 2)}</pre>\n        </code>\n      </div>\n    )\n  }\n\n  const ControlledExample = () => {\n    const [items1, setItems1] = useState([{ id: 'item-1-1', x: 0, y: 0, w: 2, h: 2 }, { id: 'item-1-2', x: 2, y: 0, w: 2, h: 2 }])\n    const [items2, setItems2] = useState([{ id: 'item-2-1', x: 0, y: 0 }, { id: 'item-2-2', x: 0, y: 1 }, { id: 'item-2-3', x: 1, y: 0 }])\n\n    return (\n      <div>\n        <div style={{display: 'flex', gap: '16px', marginBottom: '16px'}}>\n          <div></div>\n        </div>\n\n        <div style={{ display: 'flex', gap: '16px', marginBottom: '16px' }}>\n          <button onClick={() => setItems1(items => [...items, { id: `item-1-${Date.now()}`, x: 2, y: 0, w: 2, h: 2 }])}>Add Item to 1 grid</button>\n          <button onClick={() => setItems2(items => [...items, { id: `item-2-${Date.now()}`, x: 2, y: 0, w: 2, h: 2 }])}>Add Item to 2 grid</button>\n        </div>\n        <div style={{display: 'flex'}}>\n          <div style={{ display: 'flex', width: '50%' }}>\n            <ControlledStack\n              items={items1}\n              addItem={(item) => {\n                setItems1(items => [...items, item])\n              }}\n              changeItems={(items) => setItems1(items)}\n            />\n          </div >\n          <div style={{ display: 'flex', width: '50%' }}>\n            <ControlledStack\n              items={items2}\n              addItem={(item) => {\n                setItems2(items => [...items, item])\n              }}\n              changeItems={(items) => setItems2(items)}\n            />\n          </div>\n        </div >\n      </div>\n    )\n  }\n\n  ReactDOM.render(<ControlledExample />, document.getElementById('controlled-stack'))\n</script>\n</html>"
  },
  {
    "path": "demo/react-hooks.html",
    "content": "<!DOCTYPE html>\n<html>\n\n<head>\n  <meta charset=\"UTF-8\" />\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  <title>Gridstack.js React integration example</title>\n  <link rel=\"stylesheet\" href=\"demo.css\" />\n  <script src=\"../dist/gridstack-all.js\"></script>\n\n  <!-- Scripts to use react inside html -->\n  <script src=\"https://unpkg.com/react@16/umd/react.production.min.js\"></script>\n  <script src=\"https://unpkg.com/react-dom@16/umd/react-dom.production.min.js\"></script>\n  <script src=\"https://unpkg.com/babel-standalone@6.15.0/babel.min.js\"></script>\n</head>\n\n<body>\n  <div>\n    <h1>Using GridStack.js with React hooks</h1>\n    <p>\n      As with any virtual DOM based framework, you need to check if React has rendered the DOM (or any updates to it)\n      <strong>before</strong> you initialize GridStack or call its methods. This example shows how to make rendered\n      components widgets:\n    </p>\n    <ol>\n      <li>Render items, each with a reference</li>\n      <li>Convert each rendered item to a widget using the reference and the <a\n          href=\"https://github.com/gridstack/gridstack.js/tree/master/doc#makewidgetel\">\n          makeWidget()</a> function</li>\n    </ol>\n  </div>\n  <div>\n    <h2>Controlled stack</h2>\n    <div id=\"controlled-stack\"></div>\n  </div>\n  <div>\n    <h2>Uncontrolled stack</h2>\n    <div id=\"uncontrolled-stack\"></div>\n  </div>\n</body>\n\n<script type=\"text/babel\">\n  const { useState, useEffect, createRef, useRef } = React\n  const Item = ({ id }) => <div>{id}</div>\n\n  //\n  // Controlled example\n  //\n  const ControlledStack = ({ items, addItem }) => {\n    const refs = useRef({})\n    const gridRef = useRef()\n\n    if (Object.keys(refs.current).length !== items.length) {\n      items.forEach(({ id }) => {\n        refs.current[id] = refs.current[id] || createRef()\n      })\n    }\n\n    useEffect(() => {\n      gridRef.current = gridRef.current ||\n        GridStack.init({float: true}, '.controlled')\n      const grid = gridRef.current\n      grid.batchUpdate()\n      grid.removeAll(false)\n      items.forEach(({ id }) => grid.makeWidget(refs.current[id].current))\n      grid.batchUpdate(false)\n    }, [items])\n\n    return (\n      <div>\n        <button onClick={addItem}>Add new widget</button>\n        <div className={`grid-stack controlled`}>\n          {items.map((item, i) => {\n            return (\n              <div ref={refs.current[item.id]} key={item.id} className={'grid-stack-item'}>\n                <div className=\"grid-stack-item-content\">\n                  <Item {...item} />\n                </div>\n              </div>\n            )\n          })}\n        </div>\n      </div>\n    )\n  }\n\n  const ControlledExample = () => {\n    const [items, setItems] = useState([{ id: 'item-1' }, { id: 'item-2' }])\n    return (\n      <ControlledStack\n        items={items}\n        addItem={() => setItems([...items, { id: `item-${items.length + 1}` }])}\n      />\n    )\n  }\n\n  //\n  // Uncontrolled example\n  //\n  const UncontrolledExample = () => {\n    const gridRef = useRef()\n    const [state, setState] = useState({\n      count: 0,\n      info: '',\n      items: [\n        { x: 2, y: 1, h: 2 },\n        { x: 2, y: 4, w: 3 },\n        { x: 4, y: 2 },\n        { x: 3, y: 1, h: 2 },\n        { x: 0, y: 6, w: 2, h: 2 },\n      ],\n    })\n\n    useEffect(() => {\n      gridRef.current = gridRef.current ||\n        GridStack.init(\n          {\n            float: true,\n            cellHeight: '70px',\n            minRow: 1,\n          },\n          '.uncontrolled'\n        )\n      const grid = gridRef.current\n\n      grid.on('dragstop', (event, element) => {\n        const node = element.gridstackNode\n        setState(prevState => ({\n          ...prevState,\n          info: `you just dragged node #${node.id} to ${node.x},${node.y} – good job!`,\n        }))\n\n        let timerId\n        window.clearTimeout(timerId)\n        timerId = window.setTimeout(() => {\n          setState(prevState => ({\n            ...prevState,\n            info: '',\n          }))\n        }, 2000)\n      })\n    }, [])\n\n    return (\n      <div>\n        <button\n          onClick={() => {\n            const grid = gridRef.current\n            const node = state.items[state.count] || {\n              x: Math.round(12 * Math.random()),\n              y: Math.round(5 * Math.random()),\n              w: Math.round(1 + 3 * Math.random()),\n              h: Math.round(1 + 3 * Math.random()),\n            }\n            node.id = node.content = String(state.count)\n            setState(prevState => ({\n              ...prevState,\n              count: prevState.count + 1,\n            }))\n            grid.addWidget(node)\n          }}\n        >\n          Add Widget\n        </button>\n        <div>{JSON.stringify(state)}</div>\n        <section class=\"grid-stack uncontrolled\"></section>\n      </div>\n    )\n  }\n\n  ReactDOM.render(<ControlledExample />, document.getElementById('controlled-stack'))\n  ReactDOM.render(<UncontrolledExample />, document.getElementById('uncontrolled-stack'))\n</script>\n</html>"
  },
  {
    "path": "demo/react.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Gridstack.js React integration example</title>\n    <link rel=\"stylesheet\" href=\"demo.css\" />\n    <script src=\"../dist/gridstack-all.js\"></script>\n\n    <!-- Scripts to use react inside html -->\n    <script src=\"https://unpkg.com/react@16/umd/react.production.min.js\"></script>\n    <script src=\"https://unpkg.com/react-dom@16/umd/react-dom.production.min.js\"></script>\n    <script src=\"https://unpkg.com/babel-standalone@6.15.0/babel.min.js\"></script>\n  </head>\n\n  <body>\n    <div id=\"root\"></div>\n  </body>\n\n  <script type=\"text/babel\">\n    class App extends React.Component {\n      state = {\n        count: 0,\n        info: \"\",\n        items: [\n          { x: 2, y: 1, h: 2 },\n          { x: 2, y: 4, w: 3 },\n          { x: 4, y: 2 },\n          { x: 3, y: 1, h: 2 },\n          { x: 0, y: 6, w: 2, h: 2 },\n        ],\n      };\n\n      componentDidMount() {\n        // Provides access to the GridStack instance across the React component.\n        this.grid = GridStack.init({\n          float: true,\n          cellHeight: \"70px\",\n          minRow: 1,\n        });\n\n        this.grid.on(\"dragstop\", (event, element) => {\n          const node = element.gridstackNode;\n          this.setState({\n            info: `you just dragged node #${node.id} to ${node.x},${node.y} – good job!`,\n          });\n\n          // Clear the info text after a two second timeout.\n          // Clears previous timeout first.\n          window.clearTimeout(this.timerId);\n          this.timerId = window.setTimeout(() => {\n            this.setState({\n              info: \"\",\n            });\n          }, 2000);\n        });\n      }\n\n      addNewWidget = () => {\n        const node = this.state.items[this.state.count] || {\n          x: Math.round(12 * Math.random()),\n          y: Math.round(5 * Math.random()),\n          w: Math.round(1 + 3 * Math.random()),\n          h: Math.round(1 + 3 * Math.random()),\n        };\n        node.id = node.content = String(this.state.count);\n        this.setState((prevState) => ({\n          count: prevState.count + 1,\n        }));\n        this.grid.addWidget(node);\n      };\n\n      render() {\n        return (\n          <div>\n            <h1>How to integrate GridStack.js with React.js</h1>\n            <p>\n              As with any virtual DOM based framework, you need to check if React\n              has rendered the DOM (or any updates to it){\" \"}\n              <strong>before</strong> you initialize GridStack or call its\n              methods. As a basic example, check this component's{\" \"}\n              <code>mounted</code> hook.\n            </p>\n            <p>\n              If your app requires more complex render logic than the inline\n              template in `addWidget`, consider&nbsp;\n              <a href=\"https://github.com/gridstack/gridstack.js/tree/master/doc#makewidgetel\">\n                makeWidget\n              </a>\n              &nbsp;to let React deal with DOM rendering.\n            </p>\n            <button type=\"button\" onClick={this.addNewWidget}>\n              Add Widget\n            </button>\n            {this.state.info}\n            <section class=\"grid-stack\"></section>\n          </div>\n        );\n      }\n    }\n\n    ReactDOM.render(<App />, document.getElementById(\"root\"));\n  </script>\n</html>\n"
  },
  {
    "path": "demo/responsive.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <title>Responsive column</title>\n\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <script src=\"../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <div>\n    <h1>Responsive: by column size</h1>\n    <p>Using new v10 <code>GridStackOptions.columnOpts: { columnWidth: x }</code></p>\n\n    <div>\n      <span>Number of Columns:</span> <span id=\"column-text\"></span>\n    </div>\n    <div>\n      <label>Choose re-layout:</label>\n      <select onchange=\"grid.opts.columnOpts.layout = this.value\">\n        <option value=\"moveScale\">move + scale</option>\n        <option value=\"move\">move</option>\n        <option value=\"scale\">scale</option>\n        <option value=\"list\">list</option>\n        <option value=\"compact\">compact</option>\n        <option value=\"none\">none</option>\n      </select>\n      <a onClick=\"grid.removeAll()\" class=\"btn btn-primary\" href=\"#\">Clear</a>\n      <a onClick=\"addWidget()\" class=\"btn btn-primary\" href=\"#\">Add Widget</a>\n    </div>\n    <br/>\n    <div class=\"grid-stack\">\n    </div>\n  </div>\n\n  <script type=\"text/javascript\">\n    let text = document.querySelector('#column-text');\n\n    function addWidget() {\n      grid.addWidget({x:0, y:0, w:4, id:count++, content: '4x1'});\n    };\n    \n    let count = 0;\n    let items = [ // our initial 12 column layout loaded first so we can compare\n      {x: 0, y: 0},\n      {x: 1, y: 0, w: 2, h: 2, minW: 4},\n      {x: 4, y: 0, w: 2},\n      {x: 1, y: 3, w: 4},\n      {x: 5, y: 3, w: 2},\n      {x: 0, y: 4, w: 12}\n    ];\n    items.forEach(n => {n.id = count; n.content = String(count++)});\n\n    let grid = GridStack.init({\n      cellHeight: 80, // use 'auto' to make square\n      animate: false, // show immediate (animate: true is nice for user dragging though)\n      columnOpts: {\n        columnWidth: 100, // wanted width\n      },\n      children: items,\n      float: true })\n    .on('change', (ev, gsItems) => text.innerHTML = grid.getColumn());\n    text.innerHTML = grid.getColumn();\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/responsive_break.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <title>Responsive breakpoint</title>\n\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <script src=\"../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <div>\n    <h1>Responsive: using breakpoint</h1>\n    <p>Using new v10 <code>GridStackOptions.columnOpts: { breakpoints: [] }</code></p>\n    <div>\n      <span>Number of Columns:</span> <span id=\"column-text\"></span>\n    </div>\n    <div>\n      <label>Choose re-layout:</label>\n      <select onchange=\"grid.opts.columnOpts.layout = this.value\">\n        <option value=\"moveScale\">move + scale</option>\n        <option value=\"move\">move</option>\n        <option value=\"scale\">scale</option>\n        <option value=\"list\">list</option>\n        <option value=\"compact\">compact</option>\n        <option value=\"none\">none</option>\n      </select>\n      <a onClick=\"grid.removeAll()\" class=\"btn btn-primary\" href=\"#\">Clear</a>\n      <a onClick=\"addWidget()\" class=\"btn btn-primary\" href=\"#\">Add Widget</a>\n    </div>\n    <br/>\n    <div class=\"grid-stack\">\n    </div>\n  </div>\n\n  <script type=\"text/javascript\">\n    let text = document.querySelector('#column-text');\n\n    function addWidget() {\n      grid.addWidget({x:0, y:0, w:4, id:count++, content: '4x1'});\n    };\n    \n    let count = 0;\n    let items = [ // our initial 12 column layout loaded first so we can compare\n      {x: 0, y: 0},\n      {x: 1, y: 0, w: 2, h: 2},\n      {x: 4, y: 0, w: 2},\n      {x: 1, y: 3, w: 4},\n      {x: 5, y: 3, w: 2},\n      {x: 0, y: 4, w: 12}\n    ];\n    items.forEach(n => {n.id = count; n.content = String(count++)});\n\n    let grid = GridStack.init({\n      cellHeight: 80,\n      animate: false, // show immediate (animate: true is nice for user dragging though)\n      columnOpts: {\n        breakpointForWindow: true,  // test window vs grid size\n        breakpoints: [{w:700, c:1},{w:850, c:3},{w:950, c:6},{w:1100, c:8}]\n      },\n      children: items,\n      float: true })\n    .on('change', (ev, gsItems) => text.innerHTML = grid.getColumn());\n    text.innerHTML = grid.getColumn();\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/responsive_none.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Responsive layout:'none'</title>\n\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <script src=\"../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Responsive layout:'none'</h1>\n    <p>show loading a fixed (<b>layout:'none'</b>) but still responsive design (150px columns) with items w:2-4</p>\n    <p>showing how it will not change the layout unless it doesn't fit. loading into small view remembers the full layout (column:6)</p>\n    <div class=\"grid-stack\"></div>\n  </div>\n  <script src=\"events.js\"></script>\n  <script type=\"text/javascript\">\n    let children = [ {}, {}, {}];\n    children.forEach((w, i) => { \n      w.x=i, w.y=i, // comment out to have autoPosition:true which behaves differently\n      w.w=i+2, w.content = `${i} w:${w.w}`})\n    \n    GridStack.init({\n      children,\n      column: 6,\n      cellHeight: 100,\n      columnOpts: {\n        columnWidth: 150,\n        columnMax: 12,\n        layout: 'none',\n      },\n    });\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/right-to-left(rtl).html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\" dir=\"rtl\"> <!-- set text reading direction -->\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Right-To-Left (RTL) demo</title>\n  <style type=\"text/css\">\n    /* don't include demo.css as that has some forced text aligment */\n    @import \"../dist/gridstack.css\";\n    .grid-stack {\n      background: #FAFAD2;\n    }\n    .grid-stack-item-content {\n      background-color: #18bc9c;\n    }\n  </style>\n  <script src=\"../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <h1>RTL Demo</h1>\n  <div>\n    <button onClick=\"addWidget()\">Add Widget</button>\n  </div>\n  <br>\n  <div class=\"grid-stack\"></div>\n\n  <script type=\"text/javascript\">\n    let items = [\n      {x: 0, y: 0, w: 2, h: 1},\n      {x: 2, y: 0, w: 4, h: 1},\n      {x: 6, y: 0, w: 2, h: 2},\n    ];\n    items.forEach((item, i) => item.content = 'item ' + i);\n    let grid = GridStack.init({rtl: true, children: items});\n\n    function addWidget() {\n      let w = {\n        w: Math.round(1 + 3 * Math.random()),\n        h: Math.round(1 + 3 * Math.random()),\n        content: 'new item',\n      };\n      grid.addWidget(w);\n    };\n\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/serialization.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Serialization demo</title>\n\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <script src=\"../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Serialization demo</h1>\n    <a onclick=\"saveGrid()\" class=\"btn btn-primary\" href=\"#\">Save</a>\n    <a onclick=\"loadGrid()\" class=\"btn btn-primary\" href=\"#\">Load</a>\n    <a onclick=\"saveFullGrid()\" class=\"btn btn-primary\" href=\"#\">Save Full</a>\n    <a onclick=\"loadFullGrid()\" class=\"btn btn-primary\" href=\"#\">Load Full</a>\n    <a onclick=\"clearGrid()\" class=\"btn btn-primary\" href=\"#\">Clear</a>\n    <br/><br/>\n    <div id=\"gridCont\"><div class=\"grid-stack\"></div></div>\n    <hr/>\n    <textarea id=\"saved-data\" style=\"width: 100%\" cols=\"100\" rows=\"20\" readonly=\"readonly\"></textarea>\n  </div>\n  <script src=\"events.js\"></script>\n  <script type=\"text/javascript\">\n    // NOTE: REAL apps would sanitize-html or DOMPurify before blinding setting innerHTML. see #2736\n    GridStack.renderCB = function(el, w) {\n      el.innerHTML = w.content;\n    };\n\n    let serializedData = [\n      {x: 0, y: 0, w: 2, h: 2},\n      {x: 2, y: 1, w: 2, h: 3, \n      content: `<button onclick=\\\"alert('clicked!')\\\">Press me</button><div>text area</div><div><textarea></textarea></div><div>Input Field</div><input type=\"text\"><div contenteditable=\\\"true\\\">Editable Div</div><div class=\\\"no-drag\\\">no drag</div>`},\n      {x: 4, y: 1},\n      {x: 1, y: 3},\n      {x: 2, y: 3, w:3},\n    ];\n    serializedData.forEach((n, i) => {\n      n.id = String(i);\n      n.content = `<button onclick=\"removeWidget(this.parentElement.parentElement)\">X</button><br> ${i}<br> ${n.content ? n.content : ''}`;\n    });\n    let serializedFull;\n\n    let grid = GridStack.init({\n      minRow: 1, // don't let it collapse when empty\n      cellHeight: 80,\n      float: true,\n      draggable: { cancel: '.no-drag'} // example of additional custom elements to skip drag on\n    }).load(serializedData);\n    addEvents(grid);\n\n    // 2.x method - just saving list of widgets with content (default)\n    function loadGrid() {\n      grid.load(serializedData);\n    }\n\n    // 2.x method\n    function saveGrid() {\n      delete serializedFull;\n      serializedData = grid.save();\n      document.querySelector('#saved-data').value = JSON.stringify(serializedData, null, '  ');\n    }\n\n    // 3.1 full method saving the grid options + children (which is recursive for nested grids)\n    function saveFullGrid() {\n      serializedFull = grid.save(true, true);\n      serializedData = serializedFull.children;\n      document.querySelector('#saved-data').value = JSON.stringify(serializedFull, null, '  ');\n    }\n\n    // 3.1 full method to reload from scratch - delete the grid and add it back from JSON\n    function loadFullGrid() {\n      if (!serializedFull) return;\n      grid.destroy(true); // nuke everything\n      grid = GridStack.addGrid(document.querySelector('#gridCont'), serializedFull)\n    }\n\n    function clearGrid() {\n      grid.removeAll();\n    }\n\n    function removeWidget(el) {\n      // TEST removing from DOM first like Angular/React/Vue would do\n      el.remove();\n      grid.removeWidget(el, false);\n    }\n\n    // setTimeout(() => loadGrid(), 1000); // TEST force a second load which should be no-op\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/sizeToContent.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>sizeToContent demo</title>\n\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <script src=\"../dist/gridstack-all.js\"></script>\n  <style type=\"text/css\">\n    .grid-stack-item-content {\n      text-align: unset;\n    }\n    .sidebar.inline {\n      width: fit-content;\n      height: fit-content;\n      display: inline-block;\n      padding: 0;\n    }\n  </style>  \n</head>\n<body>\n  <div class=\"container\">\n    <h1>sizeToContent options demo</h1>\n    <p>New 9.x feature that size the items to fit their content height as to not have scroll bars\n    <br>case C: `sizeToContent:false` to turn off.\n    <br>case E: has soft maxsize `sizeToContent:3`, shrinking to smaller content as needed\n    <br>Defaulting to different initial size (see code) to show grow/shrink behavior</p>\n    <div>\n      <a onClick=\"clearGrid()\" class=\"btn btn-primary\" href=\"#\">clear</a>\n      <a onClick=\"load()\" class=\"btn btn-primary\" href=\"#\">load</a>\n      column:\n      <a onClick=\"column(8)\" class=\"btn btn-primary\" href=\"#\">8</a>\n      <a onClick=\"column(12)\" class=\"btn btn-primary\" href=\"#\">12</a>\n      cellHeight:\n      <a onClick=\"cellHeight(25)\" class=\"btn btn-primary\" href=\"#\">25</a>\n      <a onClick=\"cellHeight('3rem')\" class=\"btn btn-primary\" href=\"#\">3rem</a>\n      <a onClick=\"cellHeight(50)\" class=\"btn btn-primary\" href=\"#\">50</a>\n      <a onClick=\"cellHeight(75)\" class=\"btn btn-primary\" href=\"#\">75</a>\n      Widget:\n      <a onClick=\"addWidget()\" class=\"btn btn-primary\" href=\"#\">Add</a>\n      <a onClick=\"makeWidget()\" class=\"btn btn-primary\" href=\"#\">Make w:2</a>\n      <div class=\"sidebar inline\">\n        <div class=\"grid-stack-item\" gs-w=\"2\" gs-h=\"3\">\n          <div class=\"grid-stack-item-content\"><div>Insert me 2x3</div></div>\n        </div>\n      </div>\n    </div>\n    <br>\n    <div id=\"grid1\"></div>\n    <p>from DOM test:</p>\n    <div id=\"grid2\">\n      <div class=\"grid-stack-item\" gs-x=\"11\" gs-y=\"0\" gs-h=\"4\">\n        <div class=\"grid-stack-item-content\">\n          <div>DOM: h:4 sized down</div>\n        </div>\n      </div>\n    </div>\n\n  </div>\n  <script type=\"text/javascript\">\n    // NOTE: REAL apps would sanitize-html or DOMPurify before blinding setting innerHTML. see #2736\n    GridStack.renderCB = function(el, w) {\n      el.innerHTML = w.content;\n    };\n\n    let text ='some very large content that will normally not fit in the window.'\n    text = text + text;\n    let count = 0;\n    let items = [\n      // {x:0, y:0, w:2, h:3, sizeToContent: false, content: `<div>A no h: ${text}</div>`},\n      {x:0, y:0, w:2, content: `<div>A no h: ${text}</div>`},\n      {x:2, y:0, w:1, h:2, content: '<div>B: shrink h=2</div>'}, // make taller than needed upfront\n      {x:3, y:0, w:2, sizeToContent: false, content: `<div>C: WILL SCROLL. ${text}</div>`}, // prevent this from fitting testing\n      {x:0, y:1, w:3, content: `<div>D no h: ${text} ${text}</div>`},\n      {x:3, y:1, w:2, sizeToContent:3, content: `<div>E sizeToContent=3 <button onClick=\"more()\">more</button><button onClick=\"less()\">less</button><div id=\"dynContent\">${text} ${text} ${text}</div></div>`},\n    ];\n    items.forEach(n => n.id = String(count++));\n    let opts = {\n      margin: 5,\n      cellHeight: '3rem', // = 48px\n      sizeToContent: true, // default to make them all fit\n      resizable: { handles: 'all'}, // do all sides for testing\n      acceptWidgets: true,\n      // cellHeightThrottle: 100, // ms before sizeToContent happens\n      // children: items, // test loading first\n    }\n    let grid = GridStack.init(opts, '#grid1');\n    grid.load(items); // test loading after\n    GridStack.init({...opts, children:undefined}, '#grid2');\n\n    GridStack.setupDragIn('.sidebar>.grid-stack-item');\n\n    function clearGrid() {\n      grid.removeAll();\n    }\n    function load() {\n      grid.load(items);\n    }\n    function column(n) {\n      grid.column(n, 'none');\n    }\n    function cellHeight(n) {\n      grid.cellHeight(n);\n    }\n    function addWidget() {\n      grid.addWidget({content: `<div>New: ${text}</div>`});\n    }\n    function makeWidget() {\n      let el = grid.createWidgetDivs({content: `<div>New Make: ${text}</div>`}, grid.el)\n      grid.makeWidget(el, {w:2});\n    }\n    function more() {\n      let cont = document.getElementById('dynContent');\n      if (!cont) return;\n      cont.innerHTML += cont.innerHTML;\n      let el = cont.parentElement.parentElement.parentElement;\n      grid.resizeToContent(el)\n    }\n    function less() {\n      let cont = document.getElementById('dynContent');\n      if (!cont) return;\n      let content = cont.innerHTML;\n      cont.innerHTML = content.substring(0, content.length/2);\n      let el = cont.parentElement.parentElement.parentElement;\n      grid.resizeToContent(el);\n    }\n\n    // TEST\n    // grid.update(grid.engine.nodes[0].el, {x:7});\n    // load();\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/static.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Static Grid</title>\n\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <script src=\"../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Static vs can move/drag Demo</h1>\n    <p>we start with a static grid (no drag&drop initialized) with button to make it editable.</p>\n\n    <div class=\"sidebar\" style=\"height:50px\">\n      <div class=\"grid-stack-item\">\n        <div class=\"grid-stack-item-content\">Drag me</div>\n      </div>\n      <div class=\"grid-stack-item\" gs-w=\"2\" gs-h=\"1\" gs-max-w=\"3\">\n        <div class=\"grid-stack-item-content\">2x1, max=3</div>\n      </div>\n    </div>\n    <div>\n      <a class=\"btn btn-primary\" onClick=\"grid.setStatic(true)\" href=\"#\">Static</a>\n      <a class=\"btn btn-primary\" onclick=\"grid.setStatic(false)\" id=\"float\" href=\"#\">Editable</a>\n    </div>\n    <div class=\"grid-stack\"></div>\n  </div>\n  <script src=\"events.js\"></script>\n  <script type=\"text/javascript\">\n    let grid = GridStack.init({\n      float: true,\n      cellHeight: 70,\n      acceptWidgets: true,\n      removable: true,\n      staticGrid: true\n    });\n    addEvents(grid);\n\n    let serializedData = [\n      {x: 0, y: 0, w: 2, h: 2, id: '0'},\n      {x: 3, y: 1, h: 2, id: 'no_move', noMove: true, content: 'no move'},\n      {x: 4, y: 1, id: '2'},\n      {x: 2, y: 3, w: 3, id: 'no_resize', noResize: true, content: 'no resize'},\n      {x: 1, y: 3, id: 'locked', locked: true, content: 'locked'}\n    ];\n    grid.load(serializedData);\n\n    GridStack.setupDragIn('.sidebar>.grid-stack-item');\n\n    // grid.setStatic(false); // TEST enable after disabled\n\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/title_drag.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Title area drag</title>\n\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <script src=\"../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Title area drag</h1>\n    <br><br>\n    <div class=\"grid-stack\">\n      <div class=\"grid-stack-item\" gs-w=\"3\" gs-h=\"3\"><div class=\"grid-stack-item-content\">\n        <div class=\"card-header\">- Drag here -</div>\n        <div class=\"card\">the rest of the panel content doesn't drag</div>\n      </div></div>\n    </div>\n  </div>\n  <script src=\"events.js\"></script>\n  <script type=\"text/javascript\">\n    let grid = GridStack.init({ handle: '.card-header' }); // drag by the header only\n    addEvents(grid);\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/transform.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Transform Parent demo</title>\n\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <script src=\"../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Transform Parent demo</h1>\n    <p>example where the grid parent has a translate(50px, 100px) and a scale(<span id=\"scale-x\"></span>, <span id=\"scale-y\"></span>)</p>\n    <div>\n      <a class=\"btn btn-primary\" onClick=\"addNewWidget()\" href=\"#\">Add Widget</a>\n      <a class=\"btn btn-primary\" onClick=\"zoomIn()\" href=\"#\">Zoom in</a>\n      <a class=\"btn btn-primary\" onClick=\"zoomOut()\" href=\"#\">Zoom out</a>\n      <a class=\"btn btn-primary\" onClick=\"increaseScaleX()\" href=\"#\">Increase Scale X</a>\n      <a class=\"btn btn-primary\" onClick=\"decreaseScaleX()\" href=\"#\">Decrease Scale X</a>\n      <a class=\"btn btn-primary\" onClick=\"increaseScaleY()\" href=\"#\">Increase Scale Y</a>\n      <a class=\"btn btn-primary\" onClick=\"decreaseScaleY()\" href=\"#\">Decrease Scale Y</a>\n    </div>\n    <br><br>\n    <div style=\"transform: translate(50px, 100px) scale(var(--global-scale-x), var(--global-scale-y)); transform-origin: 0 0;\">\n        <div class=\"grid-stack\"></div>\n    </div>\n  </div>\n  <script src=\"events.js\"></script>\n  <script type=\"text/javascript\">\n    let scaleX = 0.5;\n    let scaleY = 0.5;\n\n    let grid = GridStack.init({float: true});\n    addEvents(grid);\n\n    let items = [\n      {x: 0, y: 0, w: 2, h: 2},\n      {x: 2, y: 0, w: 1},\n      {x: 3, y: 0, h: 1},\n      {x: 0, y: 2, w: 2},\n    ];\n    let count = 0;\n\n    getNode = function() {\n      let n = items[count] || {\n        x: Math.round(12 * Math.random()),\n        y: Math.round(5 * Math.random()),\n        w: Math.round(1 + 3 * Math.random()),\n        h: Math.round(1 + 3 * Math.random())\n      };\n      n.content = n.content || String(count);\n      count++;\n      return n;\n    };\n\n    addNewWidget = function() {\n      let w = grid.addWidget(getNode());\n    };\n\n    const updateScaleCssVariable = () => {\n      document.body.style.setProperty('--global-scale-x', `${scaleX}`);\n      document.body.style.setProperty('--global-scale-y', `${scaleY}`);\n      document.getElementById(\"scale-x\").textContent = scaleX.toFixed(2);\n      document.getElementById(\"scale-y\").textContent = scaleY.toFixed(2);\n    }\n\n    zoomIn = function() {\n      const scaleStep = scaleX < 1 ? 0.05 : 0.1;\n      scaleX += scaleStep;\n      scaleY += scaleStep;\n      updateScaleCssVariable();\n    }\n\n    zoomOut = function() {\n      if(scaleX >= 0.2 && scaleY >= 0.2) {\n        const scaleStep = scaleX < 1 ? 0.05 : 0.1;\n        scaleX -= scaleStep;\n        scaleY -= scaleStep;\n        updateScaleCssVariable();\n      }\n    }\n\n    increaseScaleX = function() {\n      const scaleStep = scaleX < 1 ? 0.05 : 0.1;\n      scaleX += scaleStep;\n      updateScaleCssVariable();\n    }\n\n    decreaseScaleX = function() {\n      if(scaleX >= 0.2) {\n        const scaleStep = scaleX < 1 ? 0.05 : 0.1;\n        scaleX -= scaleStep;\n        updateScaleCssVariable();\n      }\n    }\n\n    increaseScaleY = function() {\n      const scaleStep = scaleX < 1 ? 0.05 : 0.1;\n      scaleY += scaleStep;\n      updateScaleCssVariable();\n    }\n    \n    decreaseScaleY = function() {\n      if(scaleY >= 0.2) {\n        const scaleStep = scaleX < 1 ? 0.05 : 0.1;\n        scaleY -= scaleStep;\n        updateScaleCssVariable();\n      }\n    }\n\n    updateScaleCssVariable();\n\n\n    addNewWidget();\n    addNewWidget();\n    addNewWidget();\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/two.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Two grids demo</title>\n\n  <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css\">\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <style type=\"text/css\">\n    .with-lines { border: 1px dotted #777}\n  </style>\n\n  <script src=\"../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Two grids demo</h1>\n    <p>Two grids, one floating one not, showing drag&drop from sidebar and between grids.\n    <br>New v10.2: use 'Esc' to cancel any move/resize. Use 'r' to rotate as you drag.</p>\n\n    <div class=\"row\">\n      <div class=\"col-md-8\">\n        <!-- NOTE: add .grid-stack-item for acceptWidgets:true, but not needed for function which handles .sidebar-item (anything) -->\n        <div class=\"sidebar\">\n          <!-- will size to match content. Also see sidebarContent -->\n          <div class=\"sidebar-item\">Drag me</div>\n          <!-- constrained in code using GridStackWidget[] sidebarContent -->\n          <div class=\"sidebar-item\">2x1, max=3</div>\n          <!-- DOM JSON spelling GridStackWidget. NOTE: require content:'xyz' to work and RenderCB() to render -->\n          <div class=\"sidebar-item\" data-gs-widget='{\"w\":3, \"content\":\"drop w:3\"}'>w:3</div>\n          <!-- DOM id handled by myClone() case -->\n          <div class=\"sidebar-item\" gs-id=\"manual\">gs-id case</div>\n          <!-- DOM require proper GS format to be dropped as is without GridStackWidget above -->\n          <div class=\"grid-stack-item\" gs-w=\"3\">\n            <div class=\"grid-stack-item-content\">DOM gs-w:3</div>\n          </div>\n          <div class=\"grid-stack-item\" data-gs-widget='{\"w\":2}'>\n            <div class=\"grid-stack-item-content\">DOM w:2</div>\n          </div>\n        </div>\n      </div>\n      <div class=\"col-md-4\">\n        <div class=\"trash\" id=\"trash\">\n        </div>\n      </div>\n    </div>\n\n    <div class=\"row\" style=\"margin-top: 20px\">\n      <div class=\"col-md-6\">\n        <a onClick=\"toggleFloat(this, 0)\" class=\"btn btn-primary\" href=\"#\">float: true</a>\n        <a onClick=\"compact(0)\" class=\"btn btn-primary\" href=\"#\">Compact</a>\n        <div class=\"grid-stack\" id=\"left_grid\"></div>\n      </div>\n      <div class=\"col-md-6\">\n        <a onClick=\"toggleFloat(this, 1)\" class=\"btn btn-primary\" href=\"#\">float: false</a>\n        <a onClick=\"compact(1)\" class=\"btn btn-primary\" href=\"#\">Compact</a>\n        <div class=\"grid-stack\" id=\"right_grid\"></div>\n      </div>\n    </div>\n  </div>\n  <script src=\"events.js\"></script>\n  <script type=\"text/javascript\">\n    let items = [\n      {x: 0, y: 0, w: 2, h: 2},\n      {x: 1, y: 1, h: 2}, // intentional overlap to test collision on load\n      {x: 1, y: 1}, // intentional overlap to test collision on load\n      {x: 3, y: 1},\n      {x: 2, y: 3, w: 3, maxW: 3, content: 'has maxW=3'},\n      {x: 2, y: 5}\n    ];\n    items.forEach((item, i) => item.content = item.content || String(i));\n\n    // sidebar content (just 2, rest is other behavior) to create when we get dropped, instead of inserting the clone version\n    let sidebarContent = [\n      {content: 'dropped', id: 'dup_id'}, // test to make sure unique ids are created when dropped mutliple times...\n      {content: 'max=3', w:2, h:1, maxW: 3},\n    ];\n\n    let options = {\n      column: 6,\n      minRow: 1, // don't collapse when empty\n      cellHeight: 70,\n      float: true,\n      removable: '.trash', // true or drag-out delete class\n      /** accepts everything fcn, not just .grid-stack-item (true case) but can also be: true | false | '.someClass' value */\n      acceptWidgets: function(el) { return true },\n      children: items,\n      // itemClass: 'with-lines', // test a custom additional class #2110\n    };\n    let grids = GridStack.initAll(options);\n    grids[1].float(false);\n\n    // new v4 static method instead of setting up options on every grid (never been per grid really)\n    // new v11 method takes GridStackWidget[] to specify what to create on drop\n    // NOTE: helper:'clone' is default and typically used but have custom logic here to showcase\n    // NOTE2: handle not set to drag entire self.\n    GridStack.setupDragIn('.sidebar-item, .sidebar>.grid-stack-item', { helper: myClone }, sidebarContent);\n    // GridStack.setupDragIn(); // second call will now work (cache last values)\n\n    grids.forEach(function (grid, i) {\n      addEvents(grid, i);\n    });\n\n    // clone the sidepanel item so we drag a copy, and in some case ('manual') create the final widget, else sidebarContent will be used.\n    function myClone(el) {\n      if (el.getAttribute('gs-id') === 'manual') {\n        return grids[0].createWidgetDivs({w:2, content:'manual'}); // RenderCB() will be called\n      }\n      el = el.cloneNode(true);\n      // el.setAttribute('gs-id', 'foo'); // help debug #2231\n      // el.innerHTML = 'cloned'; // help debug\n      return el;\n    }\n\n    function toggleFloat(button, i) {\n      grids[i].float(! grids[i].getFloat());\n      button.innerHTML = 'float: ' + grids[i].getFloat();\n    }\n\n    function compact(i) {\n      grids[i].compact();\n    }\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/two_vertical.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Two vertical grids demo</title>\n  <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css\">\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\n  <script src=\"../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Two vertical grids demo - with maxRow</h1>\n    <p>special care is needed to prevent top grid from growing and causing shifts while you are dragging (which is a know issue).<br>\n    You can either set a fix row, or have enough padding on a parent div to allow for an extra row to be created as needed), or....</p>\n    <div class=\"grid-stack\" id=\"grid1\"></div>\n    <br>\n    <div class=\"grid-stack\" id=\"grid2\"></div>\n  </div>\n  <script src=\"events.js\"></script>\n  <script type=\"text/javascript\">\n    let opts = {\n      row: 1, // set min and max row to freeze the height\n      dragOut: true,\n      acceptWidgets: true\n    }\n    GridStack.init(opts, document.getElementById('grid1'))\n      .load([{x:1, y:0, content: '0'}, {x:2, y:0, content: '1'}]);\n    GridStack.init(opts, document.getElementById('grid2'))\n      .load([{x:0, y:0, content: '2'}, {x:1, y:0, content: '3'}]);\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "demo/vue2js.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vue2 Gridstack</title>\n    <link rel=\"stylesheet\" href=\"demo.css\"/>\n    <script src=\"../dist/gridstack-all.js\"></script>\n  </head>\n  <body>\n    <main id=\"app\">\n      <h1>How to integrate GridStack.js with Vue.js</h1>\n      <p>\n        As with any virtual DOM based framework, you need to check if Vue has\n        rendered the DOM (or any updates to it) <strong>before</strong> you\n        initialize GridStack or call its methods. As a basic example, check this\n        component's <code>mounted</code> hook.\n      </p>\n      <p>\n        If your app requires more complex render logic than the inline template\n        in `addWidget`, consider\n        <a\n          href=\"https://github.com/gridstack/gridstack.js/tree/master/doc#makewidgetel\"\n          >makeWidget</a\n        >\n        to let Vue deal with DOM rendering.\n      </p>\n      <button type=\"button\" @click=\"addNewWidget()\">Add Widget</button> {{ info }}\n      <div class=\"grid-stack\"></div>\n    </main>\n    <script type=\"module\">\n      import Vue from \"https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.esm.browser.js\";\n\n      let app = new Vue({\n        el: \"#app\",\n        data: {\n          // Reference to the GridStack instance to access it later\n          grid: undefined,\n          count: 0,\n          info: \"\",\n          timerId: undefined,\n        },\n        items: [\n          { x: 2, y: 1, h: 2 },\n          { x: 2, y: 4, w: 3},\n          { x: 4, y: 2},\n          { x: 3, y: 1, h: 2 },\n          { x: 0, y: 6, w: 2, h: 2 }\n        ],\n        watch: {\n          /**\n           * Clear the info text after a two second timeout. Clears previous timeout first.\n           */\n          info: function (newVal, oldVal) {\n            if (newVal.length === 0) return;\n\n            window.clearTimeout(this.timerId);\n            this.timerId = window.setTimeout(() => {\n              this.info = \"\";\n            }, 2000);\n          },\n        },\n        mounted: function () {\n          // Provides access to the GridStack instance across the Vue component.\n          this.grid = GridStack.init({ float: true, cellHeight: '70px', minRow: 1 });\n\n          // Use an arrow function so that `this` is bound to the Vue instance. Alternatively, use a custom Vue directive on the `.grid-stack` container element: https://vuejs.org/v2/guide/custom-directive.html\n          this.grid.on(\"dragstop\", (event, element) => {\n            const node = element.gridstackNode;\n            // `this` will only access your Vue instance if you used an arrow function, otherwise `this` binds to window scope. see https://hacks.mozilla.org/2015/06/es6-in-depth-arrow-functions/\n            this.info = `you just dragged node #${node.id} to ${node.x},${node.y} – good job!`;\n          });\n        },\n        methods: {\n          addNewWidget: function () {\n            const node = this.$options.items[this.count] || {\n              x: Math.round(12 * Math.random()),\n              y: Math.round(5 * Math.random()),\n              w: Math.round(1 + 3 * Math.random()),\n              h: Math.round(1 + 3 * Math.random()),\n            };\n            node.id = node.content = String(this.count++);\n            this.grid.addWidget(node);\n          },\n        },\n      });\n    </script>\n  </body>\n</html>\n"
  },
  {
    "path": "demo/vue3js.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vue3 Gridstack</title>\n    <link rel=\"stylesheet\" href=\"demo.css\"/>\n    <script src=\"../dist/gridstack-all.js\"></script>\n  </head>\n  <body>\n    <main id=\"app\">\n      <h1>How to integrate GridStack.js with Vue.js</h1>\n      <p>\n        As with any virtual DOM based framework, you need to check if Vue has\n        rendered the DOM (or any updates to it) <strong>before</strong> you\n        initialize GridStack or call its methods. As a basic example, check this\n        component's <code>mounted</code> hook.\n      </p>\n      <p>\n        If your app requires more complex render logic than the inline template\n        in `addWidget`, consider\n        <a\n          href=\"https://github.com/gridstack/gridstack.js/tree/master/doc#makewidgetel\"\n          >makeWidget</a\n        >\n        to let Vue deal with DOM rendering.\n      </p>\n      <button type=\"button\" @click=\"addNewWidget()\">Add Widget</button> {{ info }}\n      <div class=\"grid-stack\"></div>\n    </main>\n    <script type=\"module\">\n      import { createApp, ref, onMounted } from \"https://cdn.jsdelivr.net/npm/vue@3.0.11/dist/vue.esm-browser.js\";\n\n      createApp({\n        setup() {\n          let count = ref(0);\n          let info = ref(\"\");\n          let grid = null; // DO NOT use ref(null) as proxies GS will break all logic when comparing structures... see https://github.com/gridstack/gridstack.js/issues/2115\n          const items = [\n            { x: 2, y: 1, h: 2 },\n            { x: 2, y: 4, w: 3 },\n            { x: 4, y: 2 },\n            { x: 3, y: 1, h: 2 },\n            { x: 0, y: 6, w: 2, h: 2 },\n          ];\n\n          onMounted(() => {\n            grid = GridStack.init({ // DO NOT use grid.value = GridStack.init(), see above\n              float: true,\n              cellHeight: \"70px\",\n              minRow: 1,\n            });\n\n            grid.on(\"dragstop\", function (event, element) {\n              const node = element.gridstackNode;\n              info.value = `you just dragged node #${node.id} to ${node.x},${node.y} – good job!`;\n            });\n          });\n\n          function addNewWidget() {\n            const node = items[count.value] || {\n              x: Math.round(12 * Math.random()),\n              y: Math.round(5 * Math.random()),\n              w: Math.round(1 + 3 * Math.random()),\n              h: Math.round(1 + 3 * Math.random()),\n            };\n            node.id = node.content = String(count.value++);\n            grid.addWidget(node);\n          }\n\n          return {\n            info,\n            addNewWidget,\n          };\n        },\n\n        watch: {\n          /**\n           * Clear the info text after a two second timeout. Clears previous timeout first.\n           */\n          info: function (newVal) {\n            if (newVal.length === 0) return;\n\n            window.clearTimeout(this.timerId);\n            this.timerId = window.setTimeout(() => {\n              this.info = \"\";\n            }, 2000);\n          },\n        },\n      }).mount(\"#app\");\n    </script>\n  </body>\n</html>\n"
  },
  {
    "path": "demo/vue3js_dynamic-modern-renderCB.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n  <meta charset=\"UTF-8\" />\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  <title>Vue3 Gridstack: Gridstack DOM with Vue Rendering</title>\n  <link rel=\"stylesheet\" href=\"demo.css\" />\n  <script src=\"../dist/gridstack-all.js\"></script>\n</head>\n\n<body>\n  <main id=\"app\">\n    <a href=\"./index.html\">Back to All Demos</a>\n    <h1>Vue3: Gridstack Controls Vue Rendering Grid Items</h1>\n    <p>\n      <strong>Use Vue3 render functions with GridStack.renderCB</strong><br />\n      GridStack handles widget creation and Vue handles rendering the content using the modern (since V11) GridStack.renderCB.\n    </p>\n    <p>\n      Helpful Resources:\n    <ul>\n      <li><a href=\"https://vuejs.org/guide/extras/render-function.html#render-functions-jsx\" target=\"_blank\">Vue Render Functions</a></li>\n      <li><a href=\"https://stackblitz.com/edit/vitejs-vite-phhdkeju\" target=\"_blank\">This Demo as a Vue SFC on Stackblitz</a></li>\n    </ul>\n    </p>\n    <button type=\"button\" @click=\"addNewWidget\">Add Widget</button> {{ info }}\n    <div class=\"grid-stack\"></div>\n  </main>\n  <script type=\"module\">\n    import { createApp, ref, onMounted, onBeforeUnmount, h, render, toRefs } from \"https://cdn.jsdelivr.net/npm/vue@3.0.11/dist/vue.esm-browser.js\";\n\n    const GridItemComponent = {\n      props: {\n        itemId: {\n          type: [String, Number],\n          required: true,\n        },\n      },\n      emits: ['remove'],\n      setup(props, { emit }) {\n        const { itemId } = toRefs(props)\n\n        onBeforeUnmount(() => {\n          console.log(`In vue onBeforeUnmount for item ${itemId.value}`)\n        });\n\n        function handleRemove() {\n          emit('remove')\n        }\n\n        return {\n          itemId,\n          handleRemove,\n        }\n      },\n      template: `\n        <button @click=\"handleRemove\">X</button>\n        <p>\n            Vue Grid Item {{ itemId }}\n        </p>\n        `\n    }\n\n    createApp({\n      setup() {\n        let info = ref(\"\");\n        let grid = null;\n        const items = [\n          { id: 1, x: 2, y: 1, h: 2 },\n          { id: 2, x: 2, y: 4, w: 3 },\n          { id: 3, x: 4, y: 2 },\n          { id: 4, x: 3, y: 1, h: 2 },\n          { id: 5, x: 0, y: 6, w: 2, h: 2 },\n        ];\n        let count = ref(items.length);\n        const shadowDom = {}\n\n        onMounted(() => {\n          grid = GridStack.init({\n            float: true,\n            cellHeight: \"70px\",\n            minRow: 1,\n          });\n\n          // Listen for remove events to clean up Vue renders\n          grid.on('removed', function (event, items) {\n            items.forEach(item => {\n              if (shadowDom[item.id]) {\n                render(null, shadowDom[item.id]);\n                delete shadowDom[item.id];\n              }\n            });\n          });\n\n          GridStack.renderCB = function (el, widget) {\n            // el: HTMLElement div.grid-stack-item-content\n            // widget: GridStackWidget\n\n            const gridItemEl = el.closest('.grid-stack-item'); // div.grid-stack-item (parent of el)\n\n            // Create Vue component for the widget content\n            const itemId = widget.id\n            const widgetNode = h(GridItemComponent, {\n              itemId: itemId,\n              onRemove: () => { // Catch the remove event from the Vue component\n                grid.removeWidget(gridItemEl); // div.grid-stack-item\n                info.value = `Widget ${itemId} removed`;\n              }\n            })\n            shadowDom[itemId] = el\n            render(widgetNode, el) // Render Vue component into the GridStack-created element\n          }\n\n          grid.load(items);\n        });\n\n        onBeforeUnmount(() => {\n          // Clean up Vue renders\n          Object.values(shadowDom).forEach(el => {\n            render(null, el)\n          })\n        });\n\n        function addNewWidget() {\n          const node = items[count.value] || {\n            x: Math.round(12 * Math.random()),\n            y: Math.round(5 * Math.random()),\n            w: Math.round(1 + 3 * Math.random()),\n            h: Math.round(1 + 3 * Math.random()),\n          };\n          node.id = String(count.value++);\n          grid.addWidget(node);\n          info.value = `Widget ${node.id} added`;\n        }\n\n        return {\n          info,\n          addNewWidget,\n        };\n      },\n\n      watch: {\n        info: function (newVal) {\n          if (newVal.length === 0) return;\n\n          window.clearTimeout(this.timerId);\n          this.timerId = window.setTimeout(() => {\n            this.info = \"\";\n          }, 2000);\n        },\n      },\n    }).mount(\"#app\");\n  </script>\n</body>\n\n</html>"
  },
  {
    "path": "demo/vue3js_dynamic-render_grid-item-content.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vue3 Gridstack: Gridstack DOM with Vue Rendering</title>\n    <link rel=\"stylesheet\" href=\"demo.css\"/>\n    <script src=\"../dist/gridstack-all.js\"></script>\n  </head>\n  <body>\n    <main id=\"app\">\n      <a href=\"./index.html\">Back to All Demos</a>\n      <h1>Vue3: Gridstack Controls Vue Rendering Grid Item Content</h1>\n      <p>\n        <strong>Use Vue3 render functions to dynamically render only the grid item content.</strong><br />\n        GridStack is handles when items are added/removed, rendering grid item element, and Vue handles rendering <i>only</i> the item content.\n      </p>\n      <p>\n        Helpful Resources:\n        <ul>\n          <li><a href=\"https://vuejs.org/guide/extras/render-function.html#render-functions-jsx\" target=\"_blank\">Vue Render Functions</a></li>\n        </ul>\n      </p>\n      <p>\n        Notes:\n        <ul>\n          <li>This implementation currently does not support nested grid</li>\n        </ul>\n      </p>\n      <button type=\"button\" @click=\"addNewWidget()\">Add Widget</button> {{ info }}\n      <div class=\"grid-stack\"></div>\n    </main>\n    <script type=\"module\">\n      import { createApp, ref, onMounted, onBeforeUnmount, h, render, toRefs } from \"https://cdn.jsdelivr.net/npm/vue@3.0.11/dist/vue.esm-browser.js\";\n\n      const GridContentComponent = {\n        props: {\n          itemId: {\n            type: [String, Number],\n            required: true,\n          },\n        },\n        emits: ['remove'],\n        setup(props, { emit }) {\n          const { itemId } = toRefs(props)\n\n          onBeforeUnmount(() => {\n            console.log(`In vue onBeforeUnmount for item ${itemId.value}`)\n          });\n\n          function handleRemove() {\n            emit('remove', itemId.value)\n          }\n\n          return {\n            itemId,\n            handleRemove,\n          }\n        },\n        template: `\n          <div class=\"my-custom-grid-item-content\">\n            <button @click=handleRemove>X</button>\n            <p>\n              Vue Grid Item Content {{ itemId }}\n            </p>\n          </div>\n        `\n      }\n\n      createApp({\n        setup() {\n          let info = ref(\"\");\n          let grid = null; // DO NOT use ref(null) as proxies GS will break all logic when comparing structures... see https://github.com/gridstack/gridstack.js/issues/2115\n          const items = [\n            { id: 1, x: 2, y: 1, h: 2 },\n            { id: 2, x: 2, y: 4, w: 3 },\n            { id: 3, x: 4, y: 2 },\n            { id: 4, x: 3, y: 1, h: 2 },\n            { id: 5, x: 0, y: 6, w: 2, h: 2 },\n          ];\n          let count = ref(items.length);\n\n          onMounted(() => {\n            grid = GridStack.init({ // DO NOT user grid.value = GridStack.init(), see above\n              float: true,\n              cellHeight: \"70px\",\n              minRow: 1,\n            });\n\n            grid.on('added', function(event, items) {\n              for (const item of items) {\n                const itemEl = item.el\n                const itemElContent = itemEl.querySelector('.grid-stack-item-content')\n\n                const itemId = item.id\n\n                // Use Vue's render function to create the content\n                // See https://vuejs.org/guide/extras/render-function.html#render-functions-jsx\n                //      Supports: emit, slots, props, attrs, see onRemove event below\n                const itemContentVNode = h(\n                  GridContentComponent,\n                  {\n                    itemId: itemId,\n                    onRemove: (itemId) => {\n                      grid.removeWidget(itemEl)\n                    }\n                  }\n                )\n\n                // Render the vue node into the item element\n                render(itemContentVNode, itemElContent)\n              }\n            });\n\n            grid.on('removed', function(event, items) {\n              for (const item of items) {\n                const itemEl = item.el\n                const itemElContent = itemEl.querySelector('.grid-stack-item-content')\n                // Unmount the vue node from the item element\n                // Calling render with null will allow vue to clean up the DOM, and trigger lifecycle hooks\n                render(null, itemElContent)\n              }\n            });\n\n            grid.load(items);\n          });\n\n          function addNewWidget() {\n            const node = items[count.value] || {\n              x: Math.round(12 * Math.random()),\n              y: Math.round(5 * Math.random()),\n              w: Math.round(1 + 3 * Math.random()),\n              h: Math.round(1 + 3 * Math.random()),\n            };\n            node.id = String(count.value++);\n            grid.addWidget(node);\n          }\n\n          return {\n            info,\n            addNewWidget,\n          };\n        },\n\n        watch: {\n          /**\n           * Clear the info text after a two second timeout. Clears previous timeout first.\n           */\n          info: function (newVal) {\n            if (newVal.length === 0) return;\n\n            window.clearTimeout(this.timerId);\n            this.timerId = window.setTimeout(() => {\n              this.info = \"\";\n            }, 2000);\n          },\n        },\n      }).mount(\"#app\");\n    </script>\n  </body>\n</html>\n"
  },
  {
    "path": "demo/vue3js_dynamic-render_grid-item.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vue3 Gridstack: Gridstack DOM with Vue Rendering</title>\n    <link rel=\"stylesheet\" href=\"demo.css\"/>\n    <script src=\"../dist/gridstack-all.js\"></script>\n  </head>\n  <body>\n    <main id=\"app\">\n      <a href=\"./index.html\">Back to All Demos</a>\n      <h1>Vue3: Gridstack Controls Vue Rendering Grid Item</h1>\n      <p>\n        <strong>Use Vue3 render functions to dynamically render the entire Gridstack item (wrapper and contents)</strong><br />\n        GridStack is handles when items are added/removed, and Vue handles rendering of the entire item in <code>GridStack.addRemoveCB</code>.\n      </p>\n      <p>\n        Helpful Resources:\n        <ul>\n          <li><a href=\"https://vuejs.org/guide/extras/render-function.html#render-functions-jsx\" target=\"_blank\">Vue Render Functions</a></li>\n        </ul>\n      </p>\n      <p>\n        Notes:\n        <ul>\n          <li>This implementation currently does not support nested grid</li>\n        </ul>\n      </p>\n      <button type=\"button\" @click=\"addNewWidget()\">Add Widget</button> {{ info }}\n      <div class=\"grid-stack\"></div>\n    </main>\n    <script type=\"module\">\n      import { createApp, ref, onMounted, onBeforeUnmount, h, render, toRefs } from \"https://cdn.jsdelivr.net/npm/vue@3.0.11/dist/vue.esm-browser.js\";\n\n      const GridItemComponent = {\n        props: {\n          itemId: {\n            type: [String, Number],\n            required: true,\n          },\n        },\n        emits: ['remove'],\n        setup(props, { emit }) {\n          const root = ref(null)\n          const { itemId } = toRefs(props)\n\n          onBeforeUnmount(() => {\n            console.log(`In vue onBeforeUnmount for item ${itemId.value}`)\n          });\n\n          function handleRemove() {\n            emit('remove', root.value)\n          }\n\n          return {\n            root,\n            itemId,\n            handleRemove,\n          }\n        },\n        template: `\n          <div ref=\"root\" class=\"grid-stack-item my-custom-grid-item-component\">\n            <div class=\"grid-stack-item-content\">\n              <button @click=handleRemove>X</button>\n              <p>\n                Vue Grid Item {{ itemId }}\n              </p>\n            </div>\n          </div>\n        `\n      }\n\n      createApp({\n        setup() {\n          let info = ref(\"\");\n          let grid = null; // DO NOT use ref(null) as proxies GS will break all logic when comparing structures... see https://github.com/gridstack/gridstack.js/issues/2115\n          const items = [\n            { id: 1, x: 2, y: 1, h: 2 },\n            { id: 2, x: 2, y: 4, w: 3 },\n            { id: 3, x: 4, y: 2 },\n            { id: 4, x: 3, y: 1, h: 2 },\n            { id: 5, x: 0, y: 6, w: 2, h: 2 },\n          ];\n          let count = ref(items.length);\n          const shadowDom = {}\n\n          onMounted(() => {\n            grid = GridStack.init({ // DO NOT user grid.value = GridStack.init(), see above\n              float: true,\n              cellHeight: \"70px\",\n              minRow: 1,\n            });\n\n            GridStack.addRemoveCB = gsAddRemoveVueComponents;\n\n            grid.load(items);\n          });\n\n          function gsAddRemoveVueComponents(host, item, add, isGrid) {\n            if (!host) {\n              return\n            }\n\n            // Not supported yet\n            if (isGrid) {\n              return;\n            }\n\n            if (add) {\n              const itemId = item.id\n\n              // Use Vue's render function to create the content\n              // See https://vuejs.org/guide/extras/render-function.html#render-functions-jsx\n              //      Supports: emit, slots, props, attrs, see onRemove event below\n              const itemVNode = h(\n                GridItemComponent,\n                {\n                  itemId: itemId,\n                  onRemove: (itemEl) => {\n                    grid.removeWidget(itemEl)\n                  }\n                }\n              )\n              shadowDom[itemId] = document.createElement('div')\n              render(itemVNode, shadowDom[itemId])\n              return itemVNode.el\n            } else {\n              const itemId = item.id\n              render(null, shadowDom[itemId])\n              return;\n            }\n          }\n\n          function addNewWidget() {\n            const node = items[count.value] || {\n              x: Math.round(12 * Math.random()),\n              y: Math.round(5 * Math.random()),\n              w: Math.round(1 + 3 * Math.random()),\n              h: Math.round(1 + 3 * Math.random()),\n            };\n            node.id = String(count.value++);\n            grid.addWidget(node);\n          }\n\n          return {\n            info,\n            addNewWidget,\n          };\n        },\n\n        watch: {\n          /**\n           * Clear the info text after a two second timeout. Clears previous timeout first.\n           */\n          info: function (newVal) {\n            if (newVal.length === 0) return;\n\n            window.clearTimeout(this.timerId);\n            this.timerId = window.setTimeout(() => {\n              this.info = \"\";\n            }, 2000);\n          },\n        },\n      }).mount(\"#app\");\n    </script>\n  </body>\n</html>\n"
  },
  {
    "path": "demo/vue3js_v-for.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n  <meta charset=\"UTF-8\" />\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n  <title>Vue3 v-for Gridstack</title>\n  <link rel=\"stylesheet\" href=\"demo.css\" />\n  <script src=\"../dist/gridstack-all.js\"></script>\n</head>\n\n<body>\n  <main id=\"app\">\n    <h1>How to integrate GridStack.js with Vue.js</h1>\n    <p>\n      As with any virtual DOM based framework, you need to check if Vue has\n      rendered the DOM (or any updates to it) <strong>before</strong> you\n      initialize GridStack or call its methods. As a basic example, check this\n      component's <code>mounted</code> hook.\n    </p>\n    <p>\n      If your app requires more complex render logic than the inline template\n      in `addWidget`, consider\n      <a href=\"https://github.com/gridstack/gridstack.js/tree/master/doc#makewidgetel\">makeWidget</a>\n      to let Vue deal with DOM rendering.\n    </p>\n    <button type=\"button\" @click=\"addNewWidget2()\">Add Widget pos [0,0]</button>\n    <button type=\"button\" @click=\"removeLastWidget()\">Remove Last Widget</button>\n    <br>\n    <br>\n    <button type=\"button\" @click=\"changeFloat()\">Float: {{gridFloat}}</button>\n\n    <div>{{ info }}</div>\n    <br>\n    <div><b :style=\"{color: color}\">{{ gridInfo }}</b></div>\n    <br>\n\n    <div class=\"grid-stack\">\n      <div v-for=\"(w, indexs) in items\" class=\"grid-stack-item\" :gs-x=\"w.x\" :gs-y=\"w.y\" :gs-w=\"w.w\" :gs-h=\"w.h\"\n        :gs-id=\"w.id\" :id=\"w.id\" :key=\"w.id\">\n        <div class=\"grid-stack-item-content\">\n          <button @click=\"remove(w)\">remove</button>\n          {{w}}\n        </div>\n      </div>\n    </div>\n\n  </main>\n  <script type=\"module\">\n    import { createApp, ref, onMounted, nextTick } from \"https://cdn.jsdelivr.net/npm/vue@3.0.11/dist/vue.esm-browser.js\";\n\n      createApp({\n        setup() {\n          let count = ref(0);\n          let info = ref(\"\");\n          let gridFloat = ref(false);\n          let color = ref(\"black\");\n          let gridInfo = ref(\"\");\n          let grid = null; // DO NOT use ref(null) as proxies GS will break all logic when comparing structures... see https://github.com/gridstack/gridstack.js/issues/2115\n          let items = ref([]);\n\n          onMounted(() => {\n            grid = GridStack.init({ // DO NOT user grid.value = GridStack.init(), see above\n              float: false,\n              cellHeight: \"70px\",\n              minRow: 1,\n            });\n\n            grid.on(\"dragstop\", function (event, element) {\n              const node = element.gridstackNode;\n              info.value = `you just dragged node #${node.id} to ${node.x},${node.y} – good job!`;\n            });\n            \n            grid.on('change', onChange);\n            // gridFloat.value = grid.float();\n          });\n          \n          function changeFloat() {\n            gridFloat.value = !gridFloat.value;\n            grid.float(gridFloat.value);\n          }\n          \n          function onChange(event, changeItems) {\n            updateInfo();\n            // update item position\n            changeItems.forEach(item => {\n              var widget = items.value.find(w => w.id == item.id);\n              if (!widget) {\n                alert(\"Widget not found: \" + item.id);\n                return;\n              }\n              widget.x = item.x;\n              widget.y = item.y;\n              widget.w = item.w;\n              widget.h = item.h;            \n            });\n          }\n\n          function addNewWidget2() {\n            const node = items[count.value] || { x: 0, y: 0, w: 2, h: 2 };\n            node.id = 'w_'+ (count.value++);\n//          grid.addWidget(node);\n            items.value.push(node);\n            nextTick(()=>{\n              grid.makeWidget(node.id);\n              updateInfo();\n            });\n          }\n          \n          function removeLastWidget() {\n            if (count.value == 0) return;\n            var id = `w_${count.value-1}`;\n            var index = items.value.findIndex(w => w.id == id);    \n            if (index < 0) return;\n            var removed = items.value[index];\n            remove(removed);\n          }\n          \n          function remove(widget) {\n            var index = items.value.findIndex(w => w.id == widget.id);\n            items.value.splice(index, 1);\n            const selector = `#${widget.id}`;\n            grid.removeWidget(selector, false);\n            updateInfo();            \n          }\n          \n          function updateInfo() {\n            color.value = grid.engine.nodes.length == items.value.length ? \"black\" : \"red\";\n            gridInfo.value = `Grid engine: ${grid.engine.nodes.length}, widgets: ${items.value.length}`;\n          }\n\n          return {\n            info,\n            items,\n            addNewWidget2,\n            removeLastWidget,\n            onChange,\n            grid,\n            gridInfo,\n            remove,\n            gridFloat,\n            changeFloat,\n            color\n          };\n        },\n\n        watch: {\n          /**\n           * Clear the info text after a two second timeout. Clears previous timeout first.\n           */\n          info: function (newVal) {\n            if (newVal.length === 0) return;\n            window.clearTimeout(this.timerId);\n            this.timerId = window.setTimeout(() => {\n              this.info = \"\";\n            }, 2000);\n          },\n        },\n      }).mount(\"#app\");\n    </script>\n</body>\n\n</html>\n"
  },
  {
    "path": "demo/web-comp.html",
    "content": "<html>\r\n<head>\r\n  <title>Web Component demo</title>\r\n  <!-- Polyfills only needed for Firefox and Edge. -->\r\n  <script src=\"https://unpkg.com/@webcomponents/webcomponentsjs@latest/webcomponents-loader.js\"></script>\r\n  <link rel=\"stylesheet\" href=\"demo.css\"/>\r\n  <script src=\"../dist/gridstack-all.js\"></script>\r\n</head>\r\n<body>\r\n  <h1>LitElement Web Component</h1>\r\n  <script type=\"module\">\r\n    import {LitElement, html, css} from 'https://unpkg.com/lit-element@3/lit-element.js?module';\r\n\r\n    class MyElement extends LitElement {\r\n      static get properties() { return {} }\r\n      render() { return html`<style>:host {display: block;} </style><slot></slot>`; }\r\n    }\r\n    customElements.define('my-element', MyElement);\r\n</script>\r\n\r\n<my-element class=\"grid-stack\"></my-element>\r\n\r\n<script type=\"text/javascript\">\r\n  let items = [\r\n    {x:0, y:0, w:2, content: 'item 0'},\r\n    {x:0, y:1, content: 'item 1'}\r\n  ];\r\n  let grid = GridStack.init();\r\n  grid.load(items);\r\n</script>\r\n</body>\r\n</html>"
  },
  {
    "path": "demo/web1.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>demo1</title>\n\n  <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css\">\n  <link rel=\"stylesheet\" href=\"demo.css\" />\n\n  <script type=\"module\" src=\"https://unpkg.com/ionicons@4.5.10-0/dist/ionicons/ionicons.esm.js\"></script>\n  <script nomodule=\"\" src=\"https://unpkg.com/ionicons@4.5.10-0/dist/ionicons/ionicons.js\"></script>\n\n  <script src=\"../dist/gridstack-all.js\"></script>\n</head>\n\n<body>\n  <h1>Web demo 1</h1>\n  <div class=\"grid-stack\"></div>\n\n  <script type=\"text/javascript\">\n    // NOTE: REAL apps would sanitize-html or DOMPurify before blinding setting innerHTML. see #2736\n    GridStack.renderCB = function(el, w) {\n      el.innerHTML = w.content;\n    };\n\n    let children = [\n      {x: 0, y: 0, w: 4, h: 2, content: '1'},\n      {x: 4, y: 0, w: 4, h: 4, content: '2'},\n      {x: 8, y: 0, w: 2, h: 2, content: '<p class=\"card-text text-center\" style=\"margin-bottom: 0\">Drag me!<p class=\"card-text text-center\"style=\"margin-bottom: 0\"><ion-icon name=\"hand\" style=\"font-size: 300%\"></ion-icon><p class=\"card-text text-center\" style=\"margin-bottom: 0\">'},\n      {x: 10, y: 0, w: 2, h: 2, content: '4'},\n      {x: 0, y: 2, w: 2, h: 2, content: '5'},\n      {x: 2, y: 2, w: 2, h: 4, content: '6'},\n      {x: 8, y: 2, w: 4, h: 2, content: '7'},\n      {x: 0, y: 4, w: 2, h: 2, content: '8'},\n      {x: 4, y: 4, w: 4, h: 2, content: '9'},\n      {x: 8, y: 4, w: 2, h: 2, content: '10'},\n      {x: 10, y: 4, w: 2, h: 2, content: '11'},\n    ];\n\n    let grid = GridStack.init({ cellHeight: 70, children });\n    grid.on('added removed change', function(e, items) {\n      let str = '';\n      items.forEach(function(item) { str += ' (x,y)=' + item.x + ',' + item.y; });\n      console.log(e.type + ' ' + items.length + ' items:' + str );\n    });\n  </script>\n</body>\n\n</html>"
  },
  {
    "path": "demo/web2.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Advanced grid demo</title>\n\n  <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css\">\n  <link rel=\"stylesheet\" href=\"demo.css\" />\n\n  <script type=\"module\" src=\"https://unpkg.com/ionicons@4.5.10-0/dist/ionicons/ionicons.esm.js\"></script>\n  <script nomodule=\"\" src=\"https://unpkg.com/ionicons@4.5.10-0/dist/ionicons/ionicons.js\"></script>\n\n  <script src=\"../dist/gridstack-all.js\"></script>\n\n  <style type=\"text/css\">\n    .grid-stack-item-removing {\n      opacity: 0.8;\n      filter: blur(5px);\n    }\n    .sidepanel-item {\n      background-color: #18bc9c;\n      text-align: center;\n      padding: 5px;\n      margin-bottom: 15px;\n    }\n    #trash {\n      background-color: rgba(255, 0, 0, 0.4);\n    }\n    ion-icon {\n      font-size: 300%;\n    }\n  </style>\n</head>\n\n<body>\n  <h1>Advanced Demo</h1>\n  <div class=\"row\">\n    <div class=\"sidepanel col-md-2 d-none d-md-block\">\n      <div id=\"trash\" class=\"sidepanel-item\">\n        <ion-icon name=\"trash\"></ion-icon>\n        <div>Drop here to remove!</div>\n      </div>\n      <div class=\"grid-stack-item sidepanel-item\">\n        <ion-icon name=\"add-circle\"></ion-icon>\n        <div>Drag me in the dashboard!</div>\n      </div>\n    </div>\n    <div class=\"col-sm-12 col-md-10\">\n      <div class=\"grid-stack\"></div>\n    </div>\n  </div>\n\n  <script type=\"text/javascript\">\n    // NOTE: REAL apps would sanitize-html or DOMPurify before blinding setting innerHTML. see #2736\n    GridStack.renderCB = function(el, w) {\n      el.innerHTML = w.content;\n    };\n\n    let children = [\n      {x: 0, y: 0, w: 4, h: 2, content: '1'},\n      {x: 4, y: 0, w: 4, h: 4, locked: true, content: 'locked: can\\'t be pushed by others, only user!<br><ion-icon name=\"ios-lock\"></ion-icon>'},\n      {x: 8, y: 0, w: 2, h: 2, minW: 2, noResize: true, content: '<p class=\"card-text text-center\" style=\"margin-bottom: 0\">Drag me!<p class=\"card-text text-center\"style=\"margin-bottom: 0\"><ion-icon name=\"hand\"></ion-icon><p class=\"card-text text-center\" style=\"margin-bottom: 0\">...but don\\'t resize me!'},\n      {x: 10, y: 0, w: 2, h: 2, content: '4'},\n      {x: 0, y: 2, w: 2, h: 2, content: '5'},\n      {x: 2, y: 2, w: 2, h: 4, content: '6'},\n      {x: 8, y: 2, w: 4, h: 2, content: '7'},\n      {x: 0, y: 4, w: 2, h: 2, content: '8'},\n      {x: 4, y: 4, w: 4, h: 2, content: '9'},\n      {x: 8, y: 4, w: 2, h: 2, content: '10'},\n      {x: 10, y: 4, w: 2, h: 2, content: '11'},\n    ];\n    let insert = [ {h: 2, content: 'new item'}];\n\n    let grid = GridStack.init({\n      cellHeight: 70,\n      acceptWidgets: true,\n      removable: '#trash', // drag-out delete class\n      children\n    });\n    GridStack.setupDragIn('.sidepanel>.grid-stack-item', undefined, insert);\n    \n    grid.on('added removed change', function(e, items) {\n      let str = '';\n      items.forEach(function(item) { str += ' (x,y)=' + item.x + ',' + item.y; });\n      console.log(e.type + ' ' + items.length + ' items:' + str );\n    });\n  </script>\n</body>\n\n</html>\n"
  },
  {
    "path": "doc/API.md",
    "content": "# gridstack v12.4.2\n\n## Classes\n\n\n## Table of Contents\n\n- [GridStack](#gridstack)\n- [GridStackEngine](#gridstackengine)\n- [Utils](#utils)\n- [GridStackOptions](#gridstackoptions)\n- [`abstract` DDBaseImplement](#abstract-ddbaseimplement)\n- [DDDraggable](#dddraggable)\n- [DDDroppable](#dddroppable)\n- [DDElement](#ddelement)\n- [DDGridStack](#ddgridstack)\n- [DDManager](#ddmanager)\n- [DDResizable](#ddresizable-1)\n- [DDResizableHandle](#ddresizablehandle)\n- [Breakpoint](#breakpoint)\n- [CellPosition](#cellposition)\n- [DDDragOpt](#dddragopt)\n- [DDDroppableOpt](#dddroppableopt)\n- [DDElementHost](#ddelementhost)\n- [DDRemoveOpt](#ddremoveopt)\n- [DDResizableHandleOpt](#ddresizablehandleopt)\n- [DDResizableOpt](#ddresizableopt)\n- [DDResizeOpt](#ddresizeopt)\n- [DDUIData](#dduidata)\n- [DragTransform](#dragtransform)\n- [GridHTMLElement](#gridhtmlelement)\n- [GridItemHTMLElement](#griditemhtmlelement)\n- [GridStackEngineOptions](#gridstackengineoptions)\n- [GridStackMoveOpts](#gridstackmoveopts)\n- [GridStackNode](#gridstacknode-2)\n- [GridStackPosition](#gridstackposition)\n- [GridStackWidget](#gridstackwidget)\n- [HeightData](#heightdata)\n- [HTMLElementExtendOpt\\<T\\>](#htmlelementextendoptt)\n- [MousePosition](#mouseposition)\n- [Position](#position-1)\n- [Rect](#rect-1)\n- [Responsive](#responsive)\n- [Size](#size-1)\n- [gridDefaults](#griddefaults)\n- [AddRemoveFcn()](#addremovefcn)\n- [ColumnOptions](#columnoptions)\n- [CompactOptions](#compactoptions)\n- [DDCallback()](#ddcallback)\n- [DDDropOpt](#dddropopt)\n- [DDKey](#ddkey)\n- [DDOpts](#ddopts)\n- [DDValue](#ddvalue)\n- [EventCallback()](#eventcallback)\n- [GridStackDroppedHandler()](#gridstackdroppedhandler)\n- [GridStackElement](#gridstackelement)\n- [GridStackElementHandler()](#gridstackelementhandler)\n- [GridStackEvent](#gridstackevent)\n- [GridStackEventHandler()](#gridstackeventhandler)\n- [GridStackEventHandlerCallback](#gridstackeventhandlercallback)\n- [GridStackNodesHandler()](#gridstacknodeshandler)\n- [numberOrString](#numberorstring)\n- [RenderFcn()](#renderfcn)\n- [ResizeToContentFcn()](#resizetocontentfcn)\n- [SaveFcn()](#savefcn)\n\n<a id=\"gridstack\"></a>\n### GridStack\n\nDefined in: [gridstack.ts:76](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L76)\n\nMain gridstack class - you will need to call `GridStack.init()` first to initialize your grid.\r\nNote: your grid elements MUST have the following classes for the CSS layout to work:\n\n#### Example\n\n```ts\n<div class=\"grid-stack\">\r\n  <div class=\"grid-stack-item\">\r\n    <div class=\"grid-stack-item-content\">Item 1</div>\r\n  </div>\r\n</div>\n```\n\n#### Constructors\n\n##### Constructor\n\n```ts\nnew GridStack(el, opts): GridStack;\n```\n\nDefined in: [gridstack.ts:266](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L266)\n\nConstruct a grid item from the given element and options\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `el` | [`GridHTMLElement`](#gridhtmlelement) | the HTML element tied to this grid after it's been initialized |\n| `opts` | [`GridStackOptions`](#gridstackoptions) | grid options - public for classes to access, but use methods to modify! |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\n#### Methods\n\n##### \\_updateResizeEvent()\n\n```ts\nprotected _updateResizeEvent(forceRemove): GridStack;\n```\n\nDefined in: [gridstack.ts:2085](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2085)\n\nadd or remove the grid element size event handler\n\n###### Parameters\n\n| Parameter | Type | Default value |\n| ------ | ------ | ------ |\n| `forceRemove` | `boolean` | `false` |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\n##### \\_widthOrContainer()\n\n```ts\nprotected _widthOrContainer(forBreakpoint): number;\n```\n\nDefined in: [gridstack.ts:955](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L955)\n\nreturn our expected width (or parent) , and optionally of window for dynamic column check\n\n###### Parameters\n\n| Parameter | Type | Default value |\n| ------ | ------ | ------ |\n| `forBreakpoint` | `boolean` | `false` |\n\n###### Returns\n\n`number`\n\n##### addGrid()\n\n```ts\nstatic addGrid(parent, opt): GridStack;\n```\n\nDefined in: [gridstack.ts:141](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L141)\n\ncall to create a grid with the given options, including loading any children from JSON structure. This will call GridStack.init(), then\r\ngrid.load() on any passed children (recursively). Great alternative to calling init() if you want entire grid to come from\r\nJSON serialized data, including options.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `parent` | `HTMLElement` | HTML element parent to the grid |\n| `opt` | [`GridStackOptions`](#gridstackoptions) | grids options used to initialize the grid, and list of children |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\n##### addWidget()\n\n```ts\naddWidget(w): GridItemHTMLElement;\n```\n\nDefined in: [gridstack.ts:432](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L432)\n\nadd a new widget and returns it.\n\nWidget will be always placed even if result height is more than actual grid height.\r\nYou need to use `willItFit()` before calling addWidget for additional check.\r\nSee also `makeWidget(el)` for DOM element.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `w` | [`GridStackWidget`](#gridstackwidget) | GridStackWidget definition. used MakeWidget(el) if you have dom element instead. |\n\n###### Returns\n\n[`GridItemHTMLElement`](#griditemhtmlelement)\n\n###### Example\n\n```ts\nconst grid = GridStack.init();\r\ngrid.addWidget({w: 3, content: 'hello'});\n```\n\n##### batchUpdate()\n\n```ts\nbatchUpdate(flag): GridStack;\n```\n\nDefined in: [gridstack.ts:833](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L833)\n\nuse before calling a bunch of `addWidget()` to prevent un-necessary relayouts in between (more efficient)\r\nand get a single event callback. You will see no changes until `batchUpdate(false)` is called.\n\n###### Parameters\n\n| Parameter | Type | Default value |\n| ------ | ------ | ------ |\n| `flag` | `boolean` | `true` |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\n##### cellHeight()\n\n```ts\ncellHeight(val?): GridStack;\n```\n\nDefined in: [gridstack.ts:904](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L904)\n\nUpdate current cell height - see `GridStackOptions.cellHeight` for format by updating eh Browser CSS variable.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `val?` | [`numberOrString`](#numberorstring) | the cell height. Options: - `undefined`: cells content will be made square (match width minus margin) - `0`: the CSS will be generated by the application instead - number: height in pixels - string: height with units (e.g., '70px', '5rem', '2em') |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\ngrid.cellHeight(100);     // 100px height\r\ngrid.cellHeight('70px');  // explicit pixel height\r\ngrid.cellHeight('5rem');  // relative to root font size\r\ngrid.cellHeight(grid.cellWidth() * 1.2); // aspect ratio\r\ngrid.cellHeight('auto');  // auto-size based on content\n```\n\n##### cellWidth()\n\n```ts\ncellWidth(): number;\n```\n\nDefined in: [gridstack.ts:950](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L950)\n\nGets the current cell width in pixels. This is calculated based on the grid container width divided by the number of columns.\n\n###### Returns\n\n`number`\n\nthe cell width in pixels\n\n###### Example\n\n```ts\nconst width = grid.cellWidth();\r\nconsole.log('Cell width:', width, 'px');\n\n// Use cell width to calculate widget dimensions\r\nconst widgetWidth = width * 3; // For a 3-column wide widget\n```\n\n##### checkDynamicColumn()\n\n```ts\nprotected checkDynamicColumn(): boolean;\n```\n\nDefined in: [gridstack.ts:962](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L962)\n\nchecks for dynamic column count for our current size, returning true if changed\n\n###### Returns\n\n`boolean`\n\n##### column()\n\n```ts\ncolumn(column, layout): GridStack;\n```\n\nDefined in: [gridstack.ts:1041](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1041)\n\nSet the number of columns in the grid. Will update existing widgets to conform to new number of columns,\r\nas well as cache the original layout so you can revert back to previous positions without loss.\n\nRequires `gridstack-extra.css` or `gridstack-extra.min.css` for [2-11] columns,\r\nelse you will need to generate correct CSS.\r\nSee: https://github.com/gridstack/gridstack.js#change-grid-columns\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `column` | `number` | `undefined` | Integer > 0 (default 12) |\n| `layout` | [`ColumnOptions`](#columnoptions) | `'moveScale'` | specify the type of re-layout that will happen. Options: - 'moveScale' (default): scale widget positions and sizes - 'move': keep widget sizes, only move positions - 'scale': keep widget positions, only scale sizes - 'none': don't change widget positions or sizes Note: items will never be outside of the current column boundaries. Ignored for `column=1` as we always want to vertically stack. |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\n// Change to 6 columns with default scaling\r\ngrid.column(6);\n\n// Change to 4 columns, only move positions\r\ngrid.column(4, 'move');\n\n// Single column layout (vertical stack)\r\ngrid.column(1);\n```\n\n##### compact()\n\n```ts\ncompact(layout, doSort): GridStack;\n```\n\nDefined in: [gridstack.ts:1007](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1007)\n\nRe-layout grid items to reclaim any empty space. This is useful after removing widgets\r\nor when you want to optimize the layout.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `layout` | [`CompactOptions`](#compactoptions) | `'compact'` | layout type. Options: - 'compact' (default): might re-order items to fill any empty space - 'list': keep the widget left->right order the same, even if that means leaving an empty slot if things don't fit |\n| `doSort` | `boolean` | `true` | re-sort items first based on x,y position. Set to false to do your own sorting ahead (default: true) |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\n// Compact layout after removing widgets\r\ngrid.removeWidget('.widget-to-remove');\r\ngrid.compact();\n\n// Use list layout (preserve order)\r\ngrid.compact('list');\n\n// Compact without sorting first\r\ngrid.compact('compact', false);\n```\n\n##### createWidgetDivs()\n\n```ts\ncreateWidgetDivs(n): HTMLElement;\n```\n\nDefined in: [gridstack.ts:478](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L478)\n\nCreate the default grid item divs and content (possibly lazy loaded) by using GridStack.renderCB().\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `n` | [`GridStackNode`](#gridstacknode-2) | GridStackNode definition containing widget configuration |\n\n###### Returns\n\n`HTMLElement`\n\nthe created HTML element with proper grid item structure\n\n###### Example\n\n```ts\nconst element = grid.createWidgetDivs({ w: 2, h: 1, content: 'Hello World' });\n```\n\n##### destroy()\n\n```ts\ndestroy(removeDOM): GridStack;\n```\n\nDefined in: [gridstack.ts:1115](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1115)\n\nDestroys a grid instance. DO NOT CALL any methods or access any vars after this as it will free up members.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `removeDOM` | `boolean` | `true` | if `false` grid and items HTML elements will not be removed from the DOM (Optional. Default `true`). |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\n##### disable()\n\n```ts\ndisable(recurse): GridStack;\n```\n\nDefined in: [gridstack.ts:2286](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2286)\n\nTemporarily disables widgets moving/resizing.\r\nIf you want a more permanent way (which freezes up resources) use `setStatic(true)` instead.\n\nNote: This is a no-op for static grids.\n\nThis is a shortcut for:\r\n```typescript\r\ngrid.enableMove(false);\r\ngrid.enableResize(false);\r\n```\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `recurse` | `boolean` | `true` | if true (default), sub-grids also get updated |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\n// Disable all interactions\r\ngrid.disable();\n\n// Disable only this grid, not sub-grids\r\ngrid.disable(false);\n```\n\n##### enable()\n\n```ts\nenable(recurse): GridStack;\n```\n\nDefined in: [gridstack.ts:2313](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2313)\n\nRe-enables widgets moving/resizing - see disable().\r\nNote: This is a no-op for static grids.\n\nThis is a shortcut for:\r\n```typescript\r\ngrid.enableMove(true);\r\ngrid.enableResize(true);\r\n```\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `recurse` | `boolean` | `true` | if true (default), sub-grids also get updated |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\n// Re-enable all interactions\r\ngrid.enable();\n\n// Enable only this grid, not sub-grids\r\ngrid.enable(false);\n```\n\n##### enableMove()\n\n```ts\nenableMove(doEnable, recurse): GridStack;\n```\n\nDefined in: [gridstack.ts:2339](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2339)\n\nEnables/disables widget moving for all widgets. No-op for static grids.\r\nNote: locally defined items (with noMove property) still override this setting.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `doEnable` | `boolean` | `undefined` | if true widgets will be movable, if false moving is disabled |\n| `recurse` | `boolean` | `true` | if true (default), sub-grids also get updated |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\n// Enable moving for all widgets\r\ngrid.enableMove(true);\n\n// Disable moving for all widgets\r\ngrid.enableMove(false);\n\n// Enable only this grid, not sub-grids\r\ngrid.enableMove(true, false);\n```\n\n##### enableResize()\n\n```ts\nenableResize(doEnable, recurse): GridStack;\n```\n\nDefined in: [gridstack.ts:2367](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2367)\n\nEnables/disables widget resizing for all widgets. No-op for static grids.\r\nNote: locally defined items (with noResize property) still override this setting.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `doEnable` | `boolean` | `undefined` | if true widgets will be resizable, if false resizing is disabled |\n| `recurse` | `boolean` | `true` | if true (default), sub-grids also get updated |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\n// Enable resizing for all widgets\r\ngrid.enableResize(true);\n\n// Disable resizing for all widgets\r\ngrid.enableResize(false);\n\n// Enable only this grid, not sub-grids\r\ngrid.enableResize(true, false);\n```\n\n##### float()\n\n```ts\nfloat(val): GridStack;\n```\n\nDefined in: [gridstack.ts:1149](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1149)\n\nEnable/disable floating widgets (default: `false`). When enabled, widgets can float up to fill empty spaces.\r\nSee [example](http://gridstackjs.com/demo/float.html)\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `val` | `boolean` | true to enable floating, false to disable |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\ngrid.float(true);  // Enable floating\r\ngrid.float(false); // Disable floating (default)\n```\n\n##### getCellFromPixel()\n\n```ts\ngetCellFromPixel(position, useDocRelative): CellPosition;\n```\n\nDefined in: [gridstack.ts:1179](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1179)\n\nGet the position of the cell under a pixel on screen.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `position` | [`MousePosition`](#mouseposition) | `undefined` | the position of the pixel to resolve in absolute coordinates, as an object with top and left properties |\n| `useDocRelative` | `boolean` | `false` | if true, value will be based on document position vs parent position (Optional. Default false). Useful when grid is within `position: relative` element Returns an object with properties `x` and `y` i.e. the column and row in the grid. |\n\n###### Returns\n\n[`CellPosition`](#cellposition)\n\n##### getCellHeight()\n\n```ts\ngetCellHeight(forcePixel): number;\n```\n\nDefined in: [gridstack.ts:857](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L857)\n\nGets the current cell height in pixels. This takes into account the unit type and converts to pixels if necessary.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `forcePixel` | `boolean` | `false` | if true, forces conversion to pixels even when cellHeight is specified in other units |\n\n###### Returns\n\n`number`\n\nthe cell height in pixels\n\n###### Example\n\n```ts\nconst height = grid.getCellHeight();\r\nconsole.log('Cell height:', height, 'px');\n\n// Force pixel conversion\r\nconst pixelHeight = grid.getCellHeight(true);\n```\n\n##### getColumn()\n\n```ts\ngetColumn(): number;\n```\n\nDefined in: [gridstack.ts:1078](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1078)\n\nGet the number of columns in the grid (default 12).\n\n###### Returns\n\n`number`\n\nthe current number of columns in the grid\n\n###### Example\n\n```ts\nconst columnCount = grid.getColumn(); // returns 12 by default\n```\n\n##### getDD()\n\n```ts\nstatic getDD(): DDGridStack;\n```\n\nDefined in: [gridstack.ts:2183](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2183)\n\nGet the global drag & drop implementation instance.\r\nThis provides access to the underlying drag & drop functionality.\n\n###### Returns\n\n[`DDGridStack`](#ddgridstack)\n\nthe DDGridStack instance used for drag & drop operations\n\n###### Example\n\n```ts\nconst dd = GridStack.getDD();\r\n// Access drag & drop functionality\n```\n\n##### getFloat()\n\n```ts\ngetFloat(): boolean;\n```\n\nDefined in: [gridstack.ts:1166](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1166)\n\nGet the current float mode setting.\n\n###### Returns\n\n`boolean`\n\ntrue if floating is enabled, false otherwise\n\n###### Example\n\n```ts\nconst isFloating = grid.getFloat();\r\nconsole.log('Floating enabled:', isFloating);\n```\n\n##### getGridItems()\n\n```ts\ngetGridItems(): GridItemHTMLElement[];\n```\n\nDefined in: [gridstack.ts:1092](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1092)\n\nReturns an array of grid HTML elements (no placeholder) - used to iterate through our children in DOM order.\r\nThis method excludes placeholder elements and returns only actual grid items.\n\n###### Returns\n\n[`GridItemHTMLElement`](#griditemhtmlelement)[]\n\narray of GridItemHTMLElement instances representing all grid items\n\n###### Example\n\n```ts\nconst items = grid.getGridItems();\r\nitems.forEach(item => {\r\n  console.log('Item ID:', item.gridstackNode.id);\r\n});\n```\n\n##### getMargin()\n\n```ts\ngetMargin(): number;\n```\n\nDefined in: [gridstack.ts:1791](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1791)\n\nReturns the current margin value as a number (undefined if the 4 sides don't match).\r\nThis only returns a number if all sides have the same margin value.\n\n###### Returns\n\n`number`\n\nthe margin value in pixels, or undefined if sides have different values\n\n###### Example\n\n```ts\nconst margin = grid.getMargin();\r\nif (margin !== undefined) {\r\n  console.log('Uniform margin:', margin, 'px');\r\n} else {\r\n  console.log('Margins are different on different sides');\r\n}\n```\n\n##### getRow()\n\n```ts\ngetRow(): number;\n```\n\nDefined in: [gridstack.ts:1209](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1209)\n\nReturns the current number of rows, which will be at least `minRow` if set.\r\nThe row count is based on the highest positioned widget in the grid.\n\n###### Returns\n\n`number`\n\nthe current number of rows in the grid\n\n###### Example\n\n```ts\nconst rowCount = grid.getRow();\r\nconsole.log('Grid has', rowCount, 'rows');\n```\n\n##### init()\n\n```ts\nstatic init(options, elOrString): GridStack;\n```\n\nDefined in: [gridstack.ts:91](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L91)\n\ninitializing the HTML element, or selector string, into a grid will return the grid. Calling it again will\r\nsimply return the existing instance (ignore any passed options). There is also an initAll() version that support\r\nmultiple grids initialization at once. Or you can use addGrid() to create the entire grid from JSON.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `options` | [`GridStackOptions`](#gridstackoptions) | `{}` | grid options (optional) |\n| `elOrString` | [`GridStackElement`](#gridstackelement) | `'.grid-stack'` | element or CSS selector (first one used) to convert to a grid (default to '.grid-stack' class selector) |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\n###### Example\n\n```ts\nconst grid = GridStack.init();\n\nNote: the HTMLElement (of type GridHTMLElement) will store a `gridstack: GridStack` value that can be retrieve later\r\nconst grid = document.querySelector('.grid-stack').gridstack;\n```\n\n##### initAll()\n\n```ts\nstatic initAll(options, selector): GridStack[];\n```\n\nDefined in: [gridstack.ts:118](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L118)\n\nWill initialize a list of elements (given a selector) and return an array of grids.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `options` | [`GridStackOptions`](#gridstackoptions) | `{}` | grid options (optional) |\n| `selector` | `string` | `'.grid-stack'` | elements selector to convert to grids (default to '.grid-stack' class selector) |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)[]\n\n###### Example\n\n```ts\nconst grids = GridStack.initAll();\r\ngrids.forEach(...)\n```\n\n##### isAreaEmpty()\n\n```ts\nisAreaEmpty(\n   x, \n   y, \n   w, \n   h): boolean;\n```\n\nDefined in: [gridstack.ts:1228](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1228)\n\nChecks if the specified rectangular area is empty (no widgets occupy any part of it).\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `x` | `number` | the x coordinate (column) of the area to check |\n| `y` | `number` | the y coordinate (row) of the area to check |\n| `w` | `number` | the width in columns of the area to check |\n| `h` | `number` | the height in rows of the area to check |\n\n###### Returns\n\n`boolean`\n\ntrue if the area is completely empty, false if any widget overlaps\n\n###### Example\n\n```ts\n// Check if a 2x2 area at position (1,1) is empty\r\nif (grid.isAreaEmpty(1, 1, 2, 2)) {\r\n  console.log('Area is available for placement');\r\n}\n```\n\n##### isIgnoreChangeCB()\n\n```ts\nisIgnoreChangeCB(): boolean;\n```\n\nDefined in: [gridstack.ts:1109](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1109)\n\nReturns true if change callbacks should be ignored due to column change, sizeToContent, loading, etc.\r\nThis is useful for callers who want to implement dirty flag functionality.\n\n###### Returns\n\n`boolean`\n\ntrue if change callbacks are currently being ignored\n\n###### Example\n\n```ts\nif (!grid.isIgnoreChangeCB()) {\r\n  // Process the change event\r\n  console.log('Grid layout changed');\r\n}\n```\n\n##### load()\n\n```ts\nload(items, addRemove): GridStack;\n```\n\nDefined in: [gridstack.ts:722](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L722)\n\nLoad widgets from a list. This will call update() on each (matching by id) or add/remove widgets that are not there.\r\nUsed to restore a grid layout for a saved layout list (see `save()`).\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `items` | [`GridStackWidget`](#gridstackwidget)[] | list of widgets definition to update/create |\n| `addRemove` | `boolean` \\| [`AddRemoveFcn`](#addremovefcn) | boolean (default true) or callback method can be passed to control if and how missing widgets can be added/removed, giving the user control of insertion. |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\n// Basic usage with saved layout\r\nconst savedLayout = grid.save(); // Save current layout\r\n// ... later restore it\r\ngrid.load(savedLayout);\n\n// Load with custom add/remove callback\r\ngrid.load(layout, (items, grid, add) => {\r\n  if (add) {\r\n    // Custom logic for adding new widgets\r\n    items.forEach(item => {\r\n      const el = document.createElement('div');\r\n      el.innerHTML = item.content || '';\r\n      grid.addWidget(el, item);\r\n    });\r\n  } else {\r\n    // Custom logic for removing widgets\r\n    items.forEach(item => grid.removeWidget(item.el));\r\n  }\r\n});\n\n// Load without adding/removing missing widgets\r\ngrid.load(layout, false);\n```\n\n###### See\n\n[http://gridstackjs.com/demo/serialization.html](http://gridstackjs.com/demo/serialization.html) for complete example\n\n##### makeSubGrid()\n\n```ts\nmakeSubGrid(\n   el, \n   ops?, \n   nodeToAdd?, \n   saveContent?): GridStack;\n```\n\nDefined in: [gridstack.ts:506](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L506)\n\nConvert an existing gridItem element into a sub-grid with the given (optional) options, else inherit them\r\nfrom the parent's subGrid options.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `el` | [`GridItemHTMLElement`](#griditemhtmlelement) | `undefined` | gridItem element to convert |\n| `ops?` | [`GridStackOptions`](#gridstackoptions) | `undefined` | (optional) sub-grid options, else default to node, then parent settings, else defaults |\n| `nodeToAdd?` | [`GridStackNode`](#gridstacknode-2) | `undefined` | (optional) node to add to the newly created sub grid (used when dragging over existing regular item) |\n| `saveContent?` | `boolean` | `true` | if true (default) the html inside .grid-stack-content will be saved to child widget |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nnewly created grid\n\n##### makeWidget()\n\n```ts\nmakeWidget(els, options?): GridItemHTMLElement;\n```\n\nDefined in: [gridstack.ts:1256](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1256)\n\nIf you add elements to your grid by hand (or have some framework creating DOM), you have to tell gridstack afterwards to make them widgets.\r\nIf you want gridstack to add the elements for you, use `addWidget()` instead.\r\nMakes the given element a widget and returns it.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `els` | [`GridStackElement`](#gridstackelement) | widget or single selector to convert. |\n| `options?` | [`GridStackWidget`](#gridstackwidget) | widget definition to use instead of reading attributes or using default sizing values |\n\n###### Returns\n\n[`GridItemHTMLElement`](#griditemhtmlelement)\n\nthe converted GridItemHTMLElement\n\n###### Example\n\n```ts\nconst grid = GridStack.init();\n\n// Create HTML content manually, possibly looking like:\r\n// <div id=\"item-1\" gs-x=\"0\" gs-y=\"0\" gs-w=\"3\" gs-h=\"2\"></div>\r\ngrid.el.innerHTML = '<div id=\"item-1\" gs-w=\"3\"></div><div id=\"item-2\"></div>';\n\n// Convert existing elements to widgets\r\ngrid.makeWidget('#item-1'); // Uses gs-* attributes from DOM\r\ngrid.makeWidget('#item-2', {w: 2, h: 1, content: 'Hello World'});\n\n// Or pass DOM element directly\r\nconst element = document.getElementById('item-3');\r\ngrid.makeWidget(element, {x: 0, y: 1, w: 4, h: 2});\n```\n\n##### margin()\n\n```ts\nmargin(value): GridStack;\n```\n\nDefined in: [gridstack.ts:1762](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1762)\n\nUpdates the margins which will set all 4 sides at once - see `GridStackOptions.margin` for format options.\r\nSupports CSS string format of 1, 2, or 4 values or a single number.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `value` | [`numberOrString`](#numberorstring) | margin value - can be: - Single number: `10` (applies to all sides) - Two values: `'10px 20px'` (top/bottom, left/right) - Four values: `'10px 20px 5px 15px'` (top, right, bottom, left) |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\ngrid.margin(10);           // 10px all sides\r\ngrid.margin('10px 20px');  // 10px top/bottom, 20px left/right\r\ngrid.margin('5px 10px 15px 20px'); // Different for each side\n```\n\n##### movable()\n\n```ts\nmovable(els, val): GridStack;\n```\n\nDefined in: [gridstack.ts:2227](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2227)\n\nEnables/Disables dragging by the user for specific grid elements.\r\nFor all items and future items, use enableMove() instead. No-op for static grids.\n\nNote: If you want to prevent an item from moving due to being pushed around by another\r\nduring collision, use the 'locked' property instead.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `els` | [`GridStackElement`](#gridstackelement) | widget element(s) or selector to modify |\n| `val` | `boolean` | if true widget will be draggable, assuming the parent grid isn't noMove or static |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\n// Make specific widgets draggable\r\ngrid.movable('.my-widget', true);\n\n// Disable dragging for specific widgets\r\ngrid.movable('#fixed-widget', false);\n```\n\n##### off()\n\n```ts\noff(name): GridStack;\n```\n\nDefined in: [gridstack.ts:1352](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1352)\n\nunsubscribe from the 'on' event GridStackEvent\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `name` | `string` | of the event (see possible values) or list of names space separated |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\n##### offAll()\n\n```ts\noffAll(): GridStack;\n```\n\nDefined in: [gridstack.ts:1379](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1379)\n\nRemove all event handlers from the grid. This is useful for cleanup when destroying a grid.\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\ngrid.offAll(); // Remove all event listeners\n```\n\n##### on()\n\n###### Call Signature\n\n```ts\non(name, callback): GridStack;\n```\n\nDefined in: [gridstack.ts:1315](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1315)\n\nRegister event handler for grid events. You can call this on a single event name, or space separated list.\n\nSupported events:\r\n- `added`: Called when widgets are being added to a grid\r\n- `change`: Occurs when widgets change their position/size due to constraints or direct changes\r\n- `disable`: Called when grid becomes disabled\r\n- `dragstart`: Called when grid item starts being dragged\r\n- `drag`: Called while grid item is being dragged (for each new row/column value)\r\n- `dragstop`: Called after user is done moving the item, with updated DOM attributes\r\n- `dropped`: Called when an item has been dropped and accepted over a grid\r\n- `enable`: Called when grid becomes enabled\r\n- `removed`: Called when items are being removed from the grid\r\n- `resizestart`: Called before user starts resizing an item\r\n- `resize`: Called while grid item is being resized (for each new row/column value)\r\n- `resizestop`: Called after user is done resizing the item, with updated DOM attributes\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `name` | `\"dropped\"` | event name(s) to listen for (space separated for multiple) |\n| `callback` | [`GridStackDroppedHandler`](#gridstackdroppedhandler) | function to call when event occurs |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\n// Listen to multiple events at once\r\ngrid.on('added removed change', (event, items) => {\r\n  items.forEach(item => console.log('Item changed:', item));\r\n});\n\n// Listen to individual events\r\ngrid.on('added', (event, items) => {\r\n  items.forEach(item => console.log('Added item:', item));\r\n});\n```\n\n###### Call Signature\n\n```ts\non(name, callback): GridStack;\n```\n\nDefined in: [gridstack.ts:1316](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1316)\n\nRegister event handler for grid events. You can call this on a single event name, or space separated list.\n\nSupported events:\r\n- `added`: Called when widgets are being added to a grid\r\n- `change`: Occurs when widgets change their position/size due to constraints or direct changes\r\n- `disable`: Called when grid becomes disabled\r\n- `dragstart`: Called when grid item starts being dragged\r\n- `drag`: Called while grid item is being dragged (for each new row/column value)\r\n- `dragstop`: Called after user is done moving the item, with updated DOM attributes\r\n- `dropped`: Called when an item has been dropped and accepted over a grid\r\n- `enable`: Called when grid becomes enabled\r\n- `removed`: Called when items are being removed from the grid\r\n- `resizestart`: Called before user starts resizing an item\r\n- `resize`: Called while grid item is being resized (for each new row/column value)\r\n- `resizestop`: Called after user is done resizing the item, with updated DOM attributes\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `name` | `\"enable\"` \\| `\"disable\"` | event name(s) to listen for (space separated for multiple) |\n| `callback` | [`GridStackEventHandler`](#gridstackeventhandler) | function to call when event occurs |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\n// Listen to multiple events at once\r\ngrid.on('added removed change', (event, items) => {\r\n  items.forEach(item => console.log('Item changed:', item));\r\n});\n\n// Listen to individual events\r\ngrid.on('added', (event, items) => {\r\n  items.forEach(item => console.log('Added item:', item));\r\n});\n```\n\n###### Call Signature\n\n```ts\non(name, callback): GridStack;\n```\n\nDefined in: [gridstack.ts:1317](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1317)\n\nRegister event handler for grid events. You can call this on a single event name, or space separated list.\n\nSupported events:\r\n- `added`: Called when widgets are being added to a grid\r\n- `change`: Occurs when widgets change their position/size due to constraints or direct changes\r\n- `disable`: Called when grid becomes disabled\r\n- `dragstart`: Called when grid item starts being dragged\r\n- `drag`: Called while grid item is being dragged (for each new row/column value)\r\n- `dragstop`: Called after user is done moving the item, with updated DOM attributes\r\n- `dropped`: Called when an item has been dropped and accepted over a grid\r\n- `enable`: Called when grid becomes enabled\r\n- `removed`: Called when items are being removed from the grid\r\n- `resizestart`: Called before user starts resizing an item\r\n- `resize`: Called while grid item is being resized (for each new row/column value)\r\n- `resizestop`: Called after user is done resizing the item, with updated DOM attributes\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `name` | `\"change\"` \\| `\"added\"` \\| `\"removed\"` \\| `\"resizecontent\"` | event name(s) to listen for (space separated for multiple) |\n| `callback` | [`GridStackNodesHandler`](#gridstacknodeshandler) | function to call when event occurs |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\n// Listen to multiple events at once\r\ngrid.on('added removed change', (event, items) => {\r\n  items.forEach(item => console.log('Item changed:', item));\r\n});\n\n// Listen to individual events\r\ngrid.on('added', (event, items) => {\r\n  items.forEach(item => console.log('Added item:', item));\r\n});\n```\n\n###### Call Signature\n\n```ts\non(name, callback): GridStack;\n```\n\nDefined in: [gridstack.ts:1318](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1318)\n\nRegister event handler for grid events. You can call this on a single event name, or space separated list.\n\nSupported events:\r\n- `added`: Called when widgets are being added to a grid\r\n- `change`: Occurs when widgets change their position/size due to constraints or direct changes\r\n- `disable`: Called when grid becomes disabled\r\n- `dragstart`: Called when grid item starts being dragged\r\n- `drag`: Called while grid item is being dragged (for each new row/column value)\r\n- `dragstop`: Called after user is done moving the item, with updated DOM attributes\r\n- `dropped`: Called when an item has been dropped and accepted over a grid\r\n- `enable`: Called when grid becomes enabled\r\n- `removed`: Called when items are being removed from the grid\r\n- `resizestart`: Called before user starts resizing an item\r\n- `resize`: Called while grid item is being resized (for each new row/column value)\r\n- `resizestop`: Called after user is done resizing the item, with updated DOM attributes\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `name` | \\| `\"drag\"` \\| `\"dragstart\"` \\| `\"resize\"` \\| `\"resizestart\"` \\| `\"resizestop\"` \\| `\"dragstop\"` | event name(s) to listen for (space separated for multiple) |\n| `callback` | [`GridStackElementHandler`](#gridstackelementhandler) | function to call when event occurs |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\n// Listen to multiple events at once\r\ngrid.on('added removed change', (event, items) => {\r\n  items.forEach(item => console.log('Item changed:', item));\r\n});\n\n// Listen to individual events\r\ngrid.on('added', (event, items) => {\r\n  items.forEach(item => console.log('Added item:', item));\r\n});\n```\n\n###### Call Signature\n\n```ts\non(name, callback): GridStack;\n```\n\nDefined in: [gridstack.ts:1319](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1319)\n\nRegister event handler for grid events. You can call this on a single event name, or space separated list.\n\nSupported events:\r\n- `added`: Called when widgets are being added to a grid\r\n- `change`: Occurs when widgets change their position/size due to constraints or direct changes\r\n- `disable`: Called when grid becomes disabled\r\n- `dragstart`: Called when grid item starts being dragged\r\n- `drag`: Called while grid item is being dragged (for each new row/column value)\r\n- `dragstop`: Called after user is done moving the item, with updated DOM attributes\r\n- `dropped`: Called when an item has been dropped and accepted over a grid\r\n- `enable`: Called when grid becomes enabled\r\n- `removed`: Called when items are being removed from the grid\r\n- `resizestart`: Called before user starts resizing an item\r\n- `resize`: Called while grid item is being resized (for each new row/column value)\r\n- `resizestop`: Called after user is done resizing the item, with updated DOM attributes\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `name` | `string` | event name(s) to listen for (space separated for multiple) |\n| `callback` | [`GridStackEventHandlerCallback`](#gridstackeventhandlercallback) | function to call when event occurs |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\n// Listen to multiple events at once\r\ngrid.on('added removed change', (event, items) => {\r\n  items.forEach(item => console.log('Item changed:', item));\r\n});\n\n// Listen to individual events\r\ngrid.on('added', (event, items) => {\r\n  items.forEach(item => console.log('Added item:', item));\r\n});\n```\n\n##### onResize()\n\n```ts\nonResize(clientWidth): GridStack;\n```\n\nDefined in: [gridstack.ts:2024](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2024)\n\ncalled when we are being resized - check if the one Column Mode needs to be turned on/off\r\nand remember the prev columns we used, or get our count from parent, as well as check for cellHeight==='auto' (square)\r\nor `sizeToContent` gridItem options.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `clientWidth` | `number` |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\n##### prepareDragDrop()\n\n```ts\nprepareDragDrop(el, force?): GridStack;\n```\n\nDefined in: [gridstack.ts:2710](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2710)\n\nprepares the element for drag&drop - this is normally called by makeWidget() unless are are delay loading\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `el` | [`GridItemHTMLElement`](#griditemhtmlelement) | `undefined` | GridItemHTMLElement of the widget |\n| `force?` | `boolean` | `false` |  |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\n##### registerEngine()\n\n```ts\nstatic registerEngine(engineClass): void;\n```\n\nDefined in: [gridstack.ts:172](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L172)\n\ncall this method to register your engine instead of the default one.\r\nSee instead `GridStackOptions.engineClass` if you only need to\r\nreplace just one instance.\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `engineClass` | *typeof* [`GridStackEngine`](#gridstackengine-2) |\n\n###### Returns\n\n`void`\n\n##### removeAll()\n\n```ts\nremoveAll(removeDOM, triggerEvent): GridStack;\n```\n\nDefined in: [gridstack.ts:1428](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1428)\n\nRemoves all widgets from the grid.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `removeDOM` | `boolean` | `true` | if `false` DOM elements won't be removed from the tree (Default? `true`). |\n| `triggerEvent` | `boolean` | `true` | if `false` (quiet mode) element will not be added to removed list and no 'removed' callbacks will be called (Default? true). |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\n##### removeAsSubGrid()\n\n```ts\nremoveAsSubGrid(nodeThatRemoved?): void;\n```\n\nDefined in: [gridstack.ts:599](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L599)\n\ncalled when an item was converted into a nested grid to accommodate a dragged over item, but then item leaves - return back\r\nto the original grid-item. Also called to remove empty sub-grids when last item is dragged out (since re-creating is simple)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `nodeThatRemoved?` | [`GridStackNode`](#gridstacknode-2) |\n\n###### Returns\n\n`void`\n\n##### removeWidget()\n\n```ts\nremoveWidget(\n   els, \n   removeDOM, \n   triggerEvent): GridStack;\n```\n\nDefined in: [gridstack.ts:1390](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1390)\n\nRemoves widget from the grid.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `els` | [`GridStackElement`](#gridstackelement) | `undefined` | - |\n| `removeDOM` | `boolean` | `true` | if `false` DOM element won't be removed from the tree (Default? true). |\n| `triggerEvent` | `boolean` | `true` | if `false` (quiet mode) element will not be added to removed list and no 'removed' callbacks will be called (Default? true). |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\n##### resizable()\n\n```ts\nresizable(els, val): GridStack;\n```\n\nDefined in: [gridstack.ts:2253](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2253)\n\nEnables/Disables user resizing for specific grid elements.\r\nFor all items and future items, use enableResize() instead. No-op for static grids.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `els` | [`GridStackElement`](#gridstackelement) | widget element(s) or selector to modify |\n| `val` | `boolean` | if true widget will be resizable, assuming the parent grid isn't noResize or static |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\n// Make specific widgets resizable\r\ngrid.resizable('.my-widget', true);\n\n// Disable resizing for specific widgets\r\ngrid.resizable('#fixed-size-widget', false);\n```\n\n##### resizeToContent()\n\n```ts\nresizeToContent(el): void;\n```\n\nDefined in: [gridstack.ts:1652](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1652)\n\nUpdates widget height to match the content height to avoid vertical scrollbars or dead space.\r\nThis automatically adjusts the widget height based on its content size.\n\nNote: This assumes only 1 child under resizeToContentParent='.grid-stack-item-content'\r\n(sized to gridItem minus padding) that represents the entire content size.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `el` | [`GridItemHTMLElement`](#griditemhtmlelement) | the grid item element to resize |\n\n###### Returns\n\n`void`\n\n###### Example\n\n```ts\n// Resize a widget to fit its content\r\nconst widget = document.querySelector('.grid-stack-item');\r\ngrid.resizeToContent(widget);\n\n// This is commonly used with dynamic content:\r\nwidget.querySelector('.content').innerHTML = 'New longer content...';\r\ngrid.resizeToContent(widget);\n```\n\n##### rotate()\n\n```ts\nrotate(els, relative?): GridStack;\n```\n\nDefined in: [gridstack.ts:1727](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1727)\n\nRotate widgets by swapping their width and height. This is typically called when the user presses 'r' during dragging.\r\nThe rotation swaps the w/h dimensions and adjusts min/max constraints accordingly.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `els` | [`GridStackElement`](#gridstackelement) | widget element(s) or selector to rotate |\n| `relative?` | [`Position`](#position-1) | optional pixel coordinate relative to upper/left corner to rotate around (keeps that cell under cursor) |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\n// Rotate a specific widget\r\ngrid.rotate('.my-widget');\n\n// Rotate with relative positioning during drag\r\ngrid.rotate(widget, { left: 50, top: 30 });\n```\n\n##### save()\n\n```ts\nsave(\n   saveContent, \n   saveGridOpt, \n   saveCB, \n   column?): \n  | GridStackOptions\n  | GridStackWidget[];\n```\n\nDefined in: [gridstack.ts:634](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L634)\n\nsaves the current layout returning a list of widgets for serialization which might include any nested grids.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `saveContent` | `boolean` | `true` | if true (default) the latest html inside .grid-stack-content will be saved to GridStackWidget.content field, else it will be removed. |\n| `saveGridOpt` | `boolean` | `false` | if true (default false), save the grid options itself, so you can call the new GridStack.addGrid() to recreate everything from scratch. GridStackOptions.children would then contain the widget list instead. |\n| `saveCB` | [`SaveFcn`](#savefcn) | `GridStack.saveCB` | callback for each node -> widget, so application can insert additional data to be saved into the widget data structure. |\n| `column?` | `number` | `undefined` | if provided, the grid will be saved for the given column size (IFF we have matching internal saved layout, or current layout). Otherwise it will use the largest possible layout (say 12 even if rendering at 1 column) so we can restore to all layouts. NOTE: if you want to save to currently display layout, pass this.getColumn() as column. NOTE2: nested grids will ALWAYS save to the container size to be in sync with parent. |\n\n###### Returns\n\n  \\| [`GridStackOptions`](#gridstackoptions)\n  \\| [`GridStackWidget`](#gridstackwidget)[]\n\nlist of widgets or full grid option, including .children list of widgets\n\n##### setAnimation()\n\n```ts\nsetAnimation(doAnimate, delay?): GridStack;\n```\n\nDefined in: [gridstack.ts:1447](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1447)\n\nToggle the grid animation state.  Toggles the `grid-stack-animate` class.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `doAnimate` | `boolean` | if true the grid will animate. |\n| `delay?` | `boolean` | if true setting will be set on next event loop. |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\n##### setStatic()\n\n```ts\nsetStatic(\n   val, \n   updateClass, \n   recurse): GridStack;\n```\n\nDefined in: [gridstack.ts:1470](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1470)\n\nToggle the grid static state, which permanently removes/add Drag&Drop support, unlike disable()/enable() that just turns it off/on.\r\nAlso toggle the grid-stack-static class.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `val` | `boolean` | `undefined` | if true the grid become static. |\n| `updateClass` | `boolean` | `true` | true (default) if css class gets updated |\n| `recurse` | `boolean` | `true` | true (default) if sub-grids also get updated |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\n##### setupDragIn()\n\n```ts\nstatic setupDragIn(\n   dragIn?, \n   dragInOptions?, \n   widgets?, \n   root?): void;\n```\n\nDefined in: [gridstack.ts:2196](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2196)\n\ncall to setup dragging in from the outside (say toolbar), by specifying the class selection and options.\r\nCalled during GridStack.init() as options, but can also be called directly (last param are used) in case the toolbar\r\nis dynamically create and needs to be set later.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `dragIn?` | `string` \\| `HTMLElement`[] | `undefined` | string selector (ex: '.sidebar-item') or list of dom elements |\n| `dragInOptions?` | [`DDDragOpt`](#dddragopt) | `undefined` | options - see DDDragOpt. (default: {handle: '.grid-stack-item-content', appendTo: 'body'} |\n| `widgets?` | [`GridStackWidget`](#gridstackwidget)[] | `undefined` | GridStackWidget def to assign to each element which defines what to create on drop |\n| `root?` | `HTMLElement` \\| `Document` | `document` | optional root which defaults to document (for shadow dom pass the parent HTMLDocument) |\n\n###### Returns\n\n`void`\n\n##### triggerEvent()\n\n```ts\nprotected triggerEvent(event, target): void;\n```\n\nDefined in: [gridstack.ts:2964](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L2964)\n\ncall given event callback on our main top-most grid (if we're nested)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `event` | `Event` |\n| `target` | [`GridItemHTMLElement`](#griditemhtmlelement) |\n\n###### Returns\n\n`void`\n\n##### update()\n\n```ts\nupdate(els, opt): GridStack;\n```\n\nDefined in: [gridstack.ts:1548](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1548)\n\nUpdates widget position/size and other info. This is used to change widget properties after creation.\r\nCan update position, size, content, and other widget properties.\n\nNote: If you need to call this on all nodes, use load() instead which will update what changed.\r\nSetting the same x,y for multiple items will be indeterministic and likely unwanted.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `els` | [`GridStackElement`](#gridstackelement) | widget element(s) or selector to modify |\n| `opt` | [`GridStackWidget`](#gridstackwidget) | new widget options (x,y,w,h, etc.). Only those set will be updated. |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\nthe grid instance for chaining\n\n###### Example\n\n```ts\n// Update widget size and position\r\ngrid.update('.my-widget', { x: 2, y: 1, w: 3, h: 2 });\n\n// Update widget content\r\ngrid.update(widget, { content: '<p>New content</p>' });\n\n// Update multiple properties\r\ngrid.update('#my-widget', {\r\n  w: 4,\r\n  h: 3,\r\n  noResize: true,\r\n  locked: true\r\n});\n```\n\n##### updateOptions()\n\n```ts\nupdateOptions(o): GridStack;\n```\n\nDefined in: [gridstack.ts:1488](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1488)\n\nUpdates the passed in options on the grid (similar to update(widget) for for the grid options).\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `o` | [`GridStackOptions`](#gridstackoptions) |\n\n###### Returns\n\n[`GridStack`](#gridstack-1)\n\n##### willItFit()\n\n```ts\nwillItFit(node): boolean;\n```\n\nDefined in: [gridstack.ts:1805](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L1805)\n\nReturns true if the height of the grid will be less than the vertical\r\nconstraint. Always returns true if grid doesn't have height constraint.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `node` | [`GridStackWidget`](#gridstackwidget) | contains x,y,w,h,auto-position options |\n\n###### Returns\n\n`boolean`\n\n###### Example\n\n```ts\nif (grid.willItFit(newWidget)) {\r\n  grid.addWidget(newWidget);\r\n} else {\r\n  alert('Not enough free space to place the widget');\r\n}\n```\n\n#### Properties\n\n| Property | Modifier | Type | Default value | Description | Defined in |\n| ------ | ------ | ------ | ------ | ------ | ------ |\n| <a id=\"addremovecb\"></a> `addRemoveCB?` | `static` | [`AddRemoveFcn`](#addremovefcn) | `undefined` | callback method use when new items|grids needs to be created or deleted, instead of the default item: <div class=\"grid-stack-item\"><div class=\"grid-stack-item-content\">w.content</div></div> grid: <div class=\"grid-stack\">grid content...</div> add = true: the returned DOM element will then be converted to a GridItemHTMLElement using makeWidget()|GridStack:init(). add = false: the item will be removed from DOM (if not already done) grid = true|false for grid vs grid-items | [gridstack.ts:184](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L184) |\n| <a id=\"animationdelay\"></a> `animationDelay` | `public` | `number` | `undefined` | time to wait for animation (if enabled) to be done so content sizing can happen | [gridstack.ts:218](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L218) |\n| <a id=\"el-4\"></a> `el` | `public` | [`GridHTMLElement`](#gridhtmlelement) | `undefined` | the HTML element tied to this grid after it's been initialized | [gridstack.ts:266](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L266) |\n| <a id=\"engine\"></a> `engine` | `public` | [`GridStackEngine`](#gridstackengine-2) | `undefined` | engine used to implement non DOM grid functionality | [gridstack.ts:212](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L212) |\n| <a id=\"engine-1\"></a> `Engine` | `static` | *typeof* [`GridStackEngine`](#gridstackengine-2) | `GridStackEngine` | scoping so users can call new GridStack.Engine(12) for example | [gridstack.ts:209](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L209) |\n| <a id=\"engineclass\"></a> `engineClass` | `static` | *typeof* [`GridStackEngine`](#gridstackengine-2) | `undefined` | - | [gridstack.ts:220](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L220) |\n| <a id=\"opts\"></a> `opts` | `public` | [`GridStackOptions`](#gridstackoptions) | `{}` | grid options - public for classes to access, but use methods to modify! | [gridstack.ts:266](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L266) |\n| <a id=\"parentgridnode\"></a> `parentGridNode?` | `public` | [`GridStackNode`](#gridstacknode-2) | `undefined` | point to a parent grid item if we're nested (inside a grid-item in between 2 Grids) | [gridstack.ts:215](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L215) |\n| <a id=\"rendercb\"></a> `renderCB?` | `static` | [`RenderFcn`](#renderfcn) | `undefined` | callback to create the content of widgets so the app can control how to store and restore it By default this lib will do 'el.textContent = w.content' forcing text only support for avoiding potential XSS issues. | [gridstack.ts:195](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L195) |\n| <a id=\"resizeobserver\"></a> `resizeObserver` | `protected` | `ResizeObserver` | `undefined` | - | [gridstack.ts:221](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L221) |\n| <a id=\"resizetocontentcb\"></a> `resizeToContentCB?` | `static` | [`ResizeToContentFcn`](#resizetocontentfcn) | `undefined` | callback to use for resizeToContent instead of the built in one | [gridstack.ts:201](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L201) |\n| <a id=\"resizetocontentparent\"></a> `resizeToContentParent` | `static` | `string` | `'.grid-stack-item-content'` | parent class for sizing content. defaults to '.grid-stack-item-content' | [gridstack.ts:203](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L203) |\n| <a id=\"responselayout\"></a> `responseLayout` | `protected` | [`ColumnOptions`](#columnoptions) | `undefined` | - | [gridstack.ts:258](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L258) |\n| <a id=\"savecb\"></a> `saveCB?` | `static` | [`SaveFcn`](#savefcn) | `undefined` | callback during saving to application can inject extra data for each widget, on top of the grid layout properties | [gridstack.ts:189](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L189) |\n| <a id=\"updatecb\"></a> `updateCB?` | `static` | (`w`) => `void` | `undefined` | called after a widget has been updated (eg: load() into an existing list of children) so application can do extra work | [gridstack.ts:198](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L198) |\n| <a id=\"utils\"></a> `Utils` | `static` | *typeof* [`Utils`](#utils-1) | `Utils` | scoping so users can call GridStack.Utils.sort() for example | [gridstack.ts:206](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L206) |\n\n***\n\n<a id=\"gridstackengine\"></a>\n### GridStackEngine\n\nDefined in: [gridstack-engine.ts:34](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L34)\n\nDefines the GridStack engine that handles all grid layout calculations and node positioning.\nThis is the core engine that performs grid manipulation without any DOM operations.\n\nThe engine manages:\n- Node positioning and collision detection\n- Layout algorithms (compact, float, etc.)\n- Grid resizing and column changes\n- Widget movement and resizing logic\n\nNOTE: Values should not be modified directly - use the main GridStack API instead\nto ensure proper DOM updates and event triggers.\n\n#### Accessors\n\n##### float\n\n###### Get Signature\n\n```ts\nget float(): boolean;\n```\n\nDefined in: [gridstack-engine.ts:438](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L438)\n\nGet the current floating mode setting.\n\n###### Example\n\n```ts\nconst isFloating = engine.float;\nconsole.log('Floating enabled:', isFloating);\n```\n\n###### Returns\n\n`boolean`\n\ntrue if floating is enabled, false otherwise\n\n###### Set Signature\n\n```ts\nset float(val): void;\n```\n\nDefined in: [gridstack-engine.ts:421](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L421)\n\nEnable/disable floating widgets (default: `false`).\nWhen floating is enabled, widgets can move up to fill empty spaces.\nSee [example](http://gridstackjs.com/demo/float.html)\n\n###### Example\n\n```ts\nengine.float = true;  // Enable floating\nengine.float = false; // Disable floating (default)\n```\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `val` | `boolean` | true to enable floating, false to disable |\n\n###### Returns\n\n`void`\n\n#### Constructors\n\n##### Constructor\n\n```ts\nnew GridStackEngine(opts): GridStackEngine;\n```\n\nDefined in: [gridstack-engine.ts:61](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L61)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts` | [`GridStackEngineOptions`](#gridstackengineoptions) |\n\n###### Returns\n\n[`GridStackEngine`](#gridstackengine-2)\n\n#### Methods\n\n##### \\_useEntireRowArea()\n\n```ts\nprotected _useEntireRowArea(node, nn): boolean;\n```\n\nDefined in: [gridstack-engine.ts:103](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L103)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `node` | [`GridStackNode`](#gridstacknode-2) |\n| `nn` | [`GridStackPosition`](#gridstackposition) |\n\n###### Returns\n\n`boolean`\n\n##### addNode()\n\n```ts\naddNode(\n   node, \n   triggerAddEvent, \n   after?): GridStackNode;\n```\n\nDefined in: [gridstack-engine.ts:756](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L756)\n\nAdd the given node to the grid, handling collision detection and re-packing.\nThis is the main method for adding new widgets to the engine.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `node` | [`GridStackNode`](#gridstacknode-2) | `undefined` | the node to add to the grid |\n| `triggerAddEvent` | `boolean` | `false` | if true, adds node to addedNodes list for event triggering |\n| `after?` | [`GridStackNode`](#gridstacknode-2) | `undefined` | optional node to place this node after (for ordering) |\n\n###### Returns\n\n[`GridStackNode`](#gridstacknode-2)\n\nthe added node (or existing node if duplicate)\n\n###### Example\n\n```ts\nconst node = { x: 0, y: 0, w: 2, h: 1, content: 'Hello' };\nconst added = engine.addNode(node, true);\n```\n\n##### batchUpdate()\n\n```ts\nbatchUpdate(flag, doPack): GridStackEngine;\n```\n\nDefined in: [gridstack-engine.ts:85](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L85)\n\nEnable/disable batch mode for multiple operations to optimize performance.\nWhen enabled, layout updates are deferred until batch mode is disabled.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `flag` | `boolean` | `true` | true to enable batch mode, false to disable and apply changes |\n| `doPack` | `boolean` | `true` | if true (default), pack/compact nodes when disabling batch mode |\n\n###### Returns\n\n[`GridStackEngine`](#gridstackengine-2)\n\nthe engine instance for chaining\n\n###### Example\n\n```ts\n// Start batch mode for multiple operations\nengine.batchUpdate(true);\nengine.addNode(node1);\nengine.addNode(node2);\nengine.batchUpdate(false); // Apply all changes at once\n```\n\n##### beginUpdate()\n\n```ts\nbeginUpdate(node): GridStackEngine;\n```\n\nDefined in: [gridstack-engine.ts:993](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L993)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `node` | [`GridStackNode`](#gridstacknode-2) |\n\n###### Returns\n\n[`GridStackEngine`](#gridstackengine-2)\n\n##### cacheLayout()\n\n```ts\ncacheLayout(\n   nodes, \n   column, \n   clear): GridStackEngine;\n```\n\nDefined in: [gridstack-engine.ts:1199](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L1199)\n\ncall to cache the given layout internally to the given location so we can restore back when column changes size\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `nodes` | [`GridStackNode`](#gridstacknode-2)[] | `undefined` | list of nodes |\n| `column` | `number` | `undefined` | corresponding column index to save it under |\n| `clear` | `boolean` | `false` | if true, will force other caches to be removed (default false) |\n\n###### Returns\n\n[`GridStackEngine`](#gridstackengine-2)\n\n##### cacheOneLayout()\n\n```ts\ncacheOneLayout(n, column): GridStackEngine;\n```\n\nDefined in: [gridstack-engine.ts:1219](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L1219)\n\ncall to cache the given node layout internally to the given location so we can restore back when column changes size\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `n` | [`GridStackNode`](#gridstacknode-2) | - |\n| `column` | `number` | corresponding column index to save it under |\n\n###### Returns\n\n[`GridStackEngine`](#gridstackengine-2)\n\n##### changedPosConstrain()\n\n```ts\nchangedPosConstrain(node, p): boolean;\n```\n\nDefined in: [gridstack-engine.ts:915](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L915)\n\ntrue if x,y or w,h are different after clamping to min/max\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `node` | [`GridStackNode`](#gridstacknode-2) |\n| `p` | [`GridStackPosition`](#gridstackposition) |\n\n###### Returns\n\n`boolean`\n\n##### cleanupNode()\n\n```ts\ncleanupNode(node): GridStackEngine;\n```\n\nDefined in: [gridstack-engine.ts:1250](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L1250)\n\ncalled to remove all internal values but the _id\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `node` | [`GridStackNode`](#gridstacknode-2) |\n\n###### Returns\n\n[`GridStackEngine`](#gridstackengine-2)\n\n##### collide()\n\n```ts\ncollide(\n   skip, \n   area, \n   skip2?): GridStackNode;\n```\n\nDefined in: [gridstack-engine.ts:182](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L182)\n\nReturn the first node that intercepts/collides with the given node or area.\nUsed for collision detection during drag and drop operations.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `skip` | [`GridStackNode`](#gridstacknode-2) | `undefined` | the node to skip in collision detection (usually the node being moved) |\n| `area` | [`GridStackNode`](#gridstacknode-2) | `skip` | the area to check for collisions (defaults to skip node's area) |\n| `skip2?` | [`GridStackNode`](#gridstacknode-2) | `undefined` | optional second node to skip in collision detection |\n\n###### Returns\n\n[`GridStackNode`](#gridstacknode-2)\n\nthe first colliding node, or undefined if no collision\n\n###### Example\n\n```ts\nconst colliding = engine.collide(draggedNode, {x: 2, y: 1, w: 2, h: 1});\nif (colliding) {\n  console.log('Would collide with:', colliding.id);\n}\n```\n\n##### collideAll()\n\n```ts\ncollideAll(\n   skip, \n   area, \n   skip2?): GridStackNode[];\n```\n\nDefined in: [gridstack-engine.ts:200](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L200)\n\nReturn all nodes that intercept/collide with the given node or area.\nSimilar to collide() but returns all colliding nodes instead of just the first.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `skip` | [`GridStackNode`](#gridstacknode-2) | `undefined` | the node to skip in collision detection |\n| `area` | [`GridStackNode`](#gridstacknode-2) | `skip` | the area to check for collisions (defaults to skip node's area) |\n| `skip2?` | [`GridStackNode`](#gridstacknode-2) | `undefined` | optional second node to skip in collision detection |\n\n###### Returns\n\n[`GridStackNode`](#gridstacknode-2)[]\n\narray of all colliding nodes\n\n###### Example\n\n```ts\nconst allCollisions = engine.collideAll(draggedNode);\nconsole.log('Colliding with', allCollisions.length, 'nodes');\n```\n\n##### compact()\n\n```ts\ncompact(layout, doSort): GridStackEngine;\n```\n\nDefined in: [gridstack-engine.ts:388](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L388)\n\nRe-layout grid items to reclaim any empty space.\nThis optimizes the grid layout by moving items to fill gaps.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `layout` | [`CompactOptions`](#compactoptions) | `'compact'` | layout algorithm to use: - 'compact' (default): find truly empty spaces, may reorder items - 'list': keep the sort order exactly the same, move items up sequentially |\n| `doSort` | `boolean` | `true` | if true (default), sort nodes by position before compacting |\n\n###### Returns\n\n[`GridStackEngine`](#gridstackengine-2)\n\nthe engine instance for chaining\n\n###### Example\n\n```ts\n// Compact to fill empty spaces\nengine.compact();\n\n// Compact preserving item order\nengine.compact('list');\n```\n\n##### directionCollideCoverage()\n\n```ts\nprotected directionCollideCoverage(\n   node, \n   o, \n   collides): GridStackNode;\n```\n\nDefined in: [gridstack-engine.ts:207](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L207)\n\ndoes a pixel coverage collision based on where we started, returning the node that has the most coverage that is >50% mid line\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `node` | [`GridStackNode`](#gridstacknode-2) |\n| `o` | [`GridStackMoveOpts`](#gridstackmoveopts) |\n| `collides` | [`GridStackNode`](#gridstacknode-2)[] |\n\n###### Returns\n\n[`GridStackNode`](#gridstacknode-2)\n\n##### endUpdate()\n\n```ts\nendUpdate(): GridStackEngine;\n```\n\nDefined in: [gridstack-engine.ts:1002](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L1002)\n\n###### Returns\n\n[`GridStackEngine`](#gridstackengine-2)\n\n##### findCacheLayout()\n\n```ts\nprotected findCacheLayout(n, column): number;\n```\n\nDefined in: [gridstack-engine.ts:1233](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L1233)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `n` | [`GridStackNode`](#gridstacknode-2) |\n| `column` | `number` |\n\n###### Returns\n\n`number`\n\n##### findEmptyPosition()\n\n```ts\nfindEmptyPosition(\n   node, \n   nodeList, \n   column, \n   after?): boolean;\n```\n\nDefined in: [gridstack-engine.ts:722](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L722)\n\nFind the first available empty spot for the given node dimensions.\nUpdates the node's x,y attributes with the found position.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `node` | [`GridStackNode`](#gridstacknode-2) | the node to find a position for (w,h must be set) |\n| `nodeList` | [`GridStackNode`](#gridstacknode-2)[] | optional list of nodes to check against (defaults to engine nodes) |\n| `column` | `number` | optional column count (defaults to engine column count) |\n| `after?` | [`GridStackNode`](#gridstacknode-2) | optional node to start search after (maintains order) |\n\n###### Returns\n\n`boolean`\n\ntrue if an empty position was found and node was updated\n\n###### Example\n\n```ts\nconst node = { w: 2, h: 1 };\nif (engine.findEmptyPosition(node)) {\n  console.log('Found position at:', node.x, node.y);\n}\n```\n\n##### getDirtyNodes()\n\n```ts\ngetDirtyNodes(verify?): GridStackNode[];\n```\n\nDefined in: [gridstack-engine.ts:636](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L636)\n\nReturns a list of nodes that have been modified from their original values.\nThis is used to track which nodes need DOM updates.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `verify?` | `boolean` | if true, performs additional verification by comparing current vs original positions |\n\n###### Returns\n\n[`GridStackNode`](#gridstacknode-2)[]\n\narray of nodes that have been modified\n\n###### Example\n\n```ts\nconst changed = engine.getDirtyNodes();\nconsole.log('Modified nodes:', changed.length);\n\n// Get verified dirty nodes\nconst verified = engine.getDirtyNodes(true);\n```\n\n##### getRow()\n\n```ts\ngetRow(): number;\n```\n\nDefined in: [gridstack-engine.ts:989](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L989)\n\n###### Returns\n\n`number`\n\n##### isAreaEmpty()\n\n```ts\nisAreaEmpty(\n   x, \n   y, \n   w, \n   h): boolean;\n```\n\nDefined in: [gridstack-engine.ts:366](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L366)\n\nCheck if the specified rectangular area is empty (no nodes occupy any part of it).\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `x` | `number` | the x coordinate (column) of the area to check |\n| `y` | `number` | the y coordinate (row) of the area to check |\n| `w` | `number` | the width in columns of the area to check |\n| `h` | `number` | the height in rows of the area to check |\n\n###### Returns\n\n`boolean`\n\ntrue if the area is completely empty, false if any node overlaps\n\n###### Example\n\n```ts\nif (engine.isAreaEmpty(2, 1, 3, 2)) {\n  console.log('Area is available for placement');\n}\n```\n\n##### moveNode()\n\n```ts\nmoveNode(node, o): boolean;\n```\n\nDefined in: [gridstack-engine.ts:929](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L929)\n\nreturn true if the passed in node was actually moved (checks for no-op and locked)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `node` | [`GridStackNode`](#gridstacknode-2) |\n| `o` | [`GridStackMoveOpts`](#gridstackmoveopts) |\n\n###### Returns\n\n`boolean`\n\n##### moveNodeCheck()\n\n```ts\nmoveNodeCheck(node, o): boolean;\n```\n\nDefined in: [gridstack-engine.ts:843](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L843)\n\nCheck if a node can be moved to a new position, considering layout constraints.\nThis is a safer version of moveNode() that validates the move first.\n\nFor complex cases (like maxRow constraints), it simulates the move in a clone first,\nthen applies the changes only if they meet all specifications.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `node` | [`GridStackNode`](#gridstacknode-2) | the node to move |\n| `o` | [`GridStackMoveOpts`](#gridstackmoveopts) | move options including target position |\n\n###### Returns\n\n`boolean`\n\ntrue if the node was successfully moved\n\n###### Example\n\n```ts\nconst canMove = engine.moveNodeCheck(node, { x: 2, y: 1 });\nif (canMove) {\n  console.log('Node moved successfully');\n}\n```\n\n##### nodeBoundFix()\n\n```ts\nnodeBoundFix(node, resizing?): GridStackEngine;\n```\n\nDefined in: [gridstack-engine.ts:560](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L560)\n\nPart 2 of preparing a node to fit inside the grid - validates and fixes coordinates and dimensions.\nThis ensures the node fits within grid boundaries and respects min/max constraints.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `node` | [`GridStackNode`](#gridstacknode-2) | the node to validate and fix |\n| `resizing?` | `boolean` | if true, resize the node to fit; if false, move the node to fit |\n\n###### Returns\n\n[`GridStackEngine`](#gridstackengine-2)\n\nthe engine instance for chaining\n\n###### Example\n\n```ts\n// Fix a node that might be out of bounds\nengine.nodeBoundFix(node, true); // Resize to fit\nengine.nodeBoundFix(node, false); // Move to fit\n```\n\n##### prepareNode()\n\n```ts\nprepareNode(node, resizing?): GridStackNode;\n```\n\nDefined in: [gridstack-engine.ts:507](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L507)\n\nPrepare and validate a node's coordinates and values for the current grid.\nThis ensures the node has valid position, size, and properties before being added to the grid.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `node` | [`GridStackNode`](#gridstacknode-2) | the node to prepare and validate |\n| `resizing?` | `boolean` | if true, resize the node down if it's out of bounds; if false, move it to fit |\n\n###### Returns\n\n[`GridStackNode`](#gridstacknode-2)\n\nthe prepared node with valid coordinates\n\n###### Example\n\n```ts\nconst node = { w: 3, h: 2, content: 'Hello' };\nconst prepared = engine.prepareNode(node);\nconsole.log('Node prepared at:', prepared.x, prepared.y);\n```\n\n##### removeAll()\n\n```ts\nremoveAll(removeDOM, triggerEvent): GridStackEngine;\n```\n\nDefined in: [gridstack-engine.ts:816](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L816)\n\nRemove all nodes from the grid.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `removeDOM` | `boolean` | `true` | if true (default), marks all nodes for DOM removal |\n| `triggerEvent` | `boolean` | `true` | if true (default), triggers removal events |\n\n###### Returns\n\n[`GridStackEngine`](#gridstackengine-2)\n\nthe engine instance for chaining\n\n###### Example\n\n```ts\nengine.removeAll(); // Remove all nodes\n```\n\n##### removeNode()\n\n```ts\nremoveNode(\n   node, \n   removeDOM, \n   triggerEvent): GridStackEngine;\n```\n\nDefined in: [gridstack-engine.ts:790](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L790)\n\nRemove the given node from the grid.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `node` | [`GridStackNode`](#gridstacknode-2) | `undefined` | the node to remove |\n| `removeDOM` | `boolean` | `true` | if true (default), marks node for DOM removal |\n| `triggerEvent` | `boolean` | `false` | if true, adds node to removedNodes list for event triggering |\n\n###### Returns\n\n[`GridStackEngine`](#gridstackengine-2)\n\nthe engine instance for chaining\n\n###### Example\n\n```ts\nengine.removeNode(node, true, true);\n```\n\n##### removeNodeFromLayoutCache()\n\n```ts\nremoveNodeFromLayoutCache(n): void;\n```\n\nDefined in: [gridstack-engine.ts:1237](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L1237)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `n` | [`GridStackNode`](#gridstacknode-2) |\n\n###### Returns\n\n`void`\n\n##### save()\n\n```ts\nsave(\n   saveElement, \n   saveCB?, \n   column?): GridStackNode[];\n```\n\nDefined in: [gridstack-engine.ts:1018](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L1018)\n\nsaves a copy of the largest column layout (eg 12 even when rendering 1 column) so we don't loose orig layout, unless explicity column\ncount to use is given. returning a list of widgets for serialization\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `saveElement` | `boolean` | `true` | if true (default), the element will be saved to GridStackWidget.el field, else it will be removed. |\n| `saveCB?` | [`SaveFcn`](#savefcn) | `undefined` | callback for each node -> widget, so application can insert additional data to be saved into the widget data structure. |\n| `column?` | `number` | `undefined` | if provided, the grid will be saved for the given column count (IFF we have matching internal saved layout, or current layout). Note: nested grids will ALWAYS save the container w to match overall layouts (parent + child) to be consistent. |\n\n###### Returns\n\n[`GridStackNode`](#gridstacknode-2)[]\n\n##### sortNodes()\n\n```ts\nsortNodes(dir): GridStackEngine;\n```\n\nDefined in: [gridstack-engine.ts:451](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L451)\n\nSort the nodes array from first to last, or reverse.\nThis is called during collision/placement operations to enforce a specific order.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `dir` | `-1` \\| `1` | `1` | sort direction: 1 for ascending (first to last), -1 for descending (last to first) |\n\n###### Returns\n\n[`GridStackEngine`](#gridstackengine-2)\n\nthe engine instance for chaining\n\n###### Example\n\n```ts\nengine.sortNodes();    // Sort ascending (default)\nengine.sortNodes(-1);  // Sort descending\n```\n\n##### swap()\n\n```ts\nswap(a, b): boolean;\n```\n\nDefined in: [gridstack-engine.ts:314](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L314)\n\nAttempt to swap the positions of two nodes if they meet swapping criteria.\nNodes can swap if they are the same size or in the same column/row, not locked, and touching.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `a` | [`GridStackNode`](#gridstacknode-2) | first node to swap |\n| `b` | [`GridStackNode`](#gridstacknode-2) | second node to swap |\n\n###### Returns\n\n`boolean`\n\ntrue if swap was successful, false if not possible, undefined if not applicable\n\n###### Example\n\n```ts\nconst swapped = engine.swap(nodeA, nodeB);\nif (swapped) {\n  console.log('Nodes swapped successfully');\n}\n```\n\n##### willItFit()\n\n```ts\nwillItFit(node): boolean;\n```\n\nDefined in: [gridstack-engine.ts:894](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L894)\n\nreturn true if can fit in grid height constrain only (always true if no maxRow)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `node` | [`GridStackNode`](#gridstacknode-2) |\n\n###### Returns\n\n`boolean`\n\n#### Properties\n\n| Property | Modifier | Type | Default value | Description | Defined in |\n| ------ | ------ | ------ | ------ | ------ | ------ |\n| <a id=\"addednodes\"></a> `addedNodes` | `public` | [`GridStackNode`](#gridstacknode-2)[] | `[]` | - | [gridstack-engine.ts:38](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L38) |\n| <a id=\"batchmode\"></a> `batchMode` | `public` | `boolean` | `undefined` | - | [gridstack-engine.ts:40](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L40) |\n| <a id=\"column-2\"></a> `column` | `public` | `number` | `undefined` | - | [gridstack-engine.ts:35](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L35) |\n| <a id=\"defaultcolumn\"></a> `defaultColumn` | `public` | `number` | `12` | - | [gridstack-engine.ts:41](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L41) |\n| <a id=\"maxrow\"></a> `maxRow` | `public` | `number` | `undefined` | - | [gridstack-engine.ts:36](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L36) |\n| <a id=\"nodes\"></a> `nodes` | `public` | [`GridStackNode`](#gridstacknode-2)[] | `undefined` | - | [gridstack-engine.ts:37](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L37) |\n| <a id=\"removednodes\"></a> `removedNodes` | `public` | [`GridStackNode`](#gridstacknode-2)[] | `[]` | - | [gridstack-engine.ts:39](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L39) |\n| <a id=\"skipcacheupdate\"></a> `skipCacheUpdate?` | `public` | `boolean` | `undefined` | true when grid.load() already cached the layout and can skip out of bound caching info | [gridstack-engine.ts:55](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L55) |\n\n***\n\n<a id=\"utils\"></a>\n### Utils\n\nDefined in: [utils.ts:97](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L97)\n\nCollection of utility methods used throughout GridStack.\r\nThese are general-purpose helper functions for DOM manipulation,\r\npositioning calculations, object operations, and more.\n\n#### Constructors\n\n##### Constructor\n\n```ts\nnew Utils(): Utils;\n```\n\n###### Returns\n\n[`Utils`](#utils-1)\n\n#### Methods\n\n##### addElStyles()\n\n```ts\nstatic addElStyles(el, styles): void;\n```\n\nDefined in: [utils.ts:701](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L701)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `el` | `HTMLElement` |\n| `styles` | \\{ \\[`prop`: `string`\\]: `string` \\| `string`[]; \\} |\n\n###### Returns\n\n`void`\n\n##### appendTo()\n\n```ts\nstatic appendTo(el, parent): void;\n```\n\nDefined in: [utils.ts:683](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L683)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `el` | `HTMLElement` |\n| `parent` | `string` \\| `HTMLElement` |\n\n###### Returns\n\n`void`\n\n##### area()\n\n```ts\nstatic area(a): number;\n```\n\nDefined in: [utils.ts:297](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L297)\n\nCalculate the total area of a grid position.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `a` | [`GridStackPosition`](#gridstackposition) | position with width and height |\n\n###### Returns\n\n`number`\n\nthe total area (width * height)\n\n###### Example\n\n```ts\nconst area = Utils.area({x: 0, y: 0, w: 3, h: 2}); // returns 6\n```\n\n##### areaIntercept()\n\n```ts\nstatic areaIntercept(a, b): number;\n```\n\nDefined in: [utils.ts:278](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L278)\n\nCalculate the overlapping area between two grid positions.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `a` | [`GridStackPosition`](#gridstackposition) | first position |\n| `b` | [`GridStackPosition`](#gridstackposition) | second position |\n\n###### Returns\n\n`number`\n\nthe area of overlap (0 if no overlap)\n\n###### Example\n\n```ts\nconst overlap = Utils.areaIntercept(\r\n  {x: 0, y: 0, w: 3, h: 2},\r\n  {x: 1, y: 0, w: 3, h: 2}\r\n); // returns 4 (2x2 overlap)\n```\n\n##### canBeRotated()\n\n```ts\nstatic canBeRotated(n): boolean;\n```\n\nDefined in: [utils.ts:804](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L804)\n\ntrue if the item can be rotated (checking for prop, not space available)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `n` | [`GridStackNode`](#gridstacknode-2) |\n\n###### Returns\n\n`boolean`\n\n##### clone()\n\n```ts\nstatic clone<T>(obj): T;\n```\n\nDefined in: [utils.ts:646](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L646)\n\nsingle level clone, returning a new object with same top fields. This will share sub objects and arrays\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `T` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `obj` | `T` |\n\n###### Returns\n\n`T`\n\n##### cloneDeep()\n\n```ts\nstatic cloneDeep<T>(obj): T;\n```\n\nDefined in: [utils.ts:662](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L662)\n\nRecursive clone version that returns a full copy, checking for nested objects and arrays ONLY.\r\nNote: this will use as-is any key starting with double __ (and not copy inside) some lib have circular dependencies.\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `T` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `obj` | `T` |\n\n###### Returns\n\n`T`\n\n##### cloneNode()\n\n```ts\nstatic cloneNode(el): HTMLElement;\n```\n\nDefined in: [utils.ts:677](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L677)\n\ndeep clone the given HTML node, removing teh unique id field\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `el` | `HTMLElement` |\n\n###### Returns\n\n`HTMLElement`\n\n##### copyPos()\n\n```ts\nstatic copyPos(\n   a, \n   b, \n   doMinMax): GridStackWidget;\n```\n\nDefined in: [utils.ts:474](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L474)\n\nCopy position and size properties from one widget to another.\r\nCopies x, y, w, h and optionally min/max constraints.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `a` | [`GridStackWidget`](#gridstackwidget) | `undefined` | target widget to copy to |\n| `b` | [`GridStackWidget`](#gridstackwidget) | `undefined` | source widget to copy from |\n| `doMinMax` | `boolean` | `false` | if true, also copy min/max width/height constraints |\n\n###### Returns\n\n[`GridStackWidget`](#gridstackwidget)\n\nthe target widget (a)\n\n###### Example\n\n```ts\nUtils.copyPos(widget1, widget2); // Copy position/size\r\nUtils.copyPos(widget1, widget2, true); // Also copy constraints\n```\n\n##### createDiv()\n\n```ts\nstatic createDiv(classes, parent?): HTMLElement;\n```\n\nDefined in: [utils.ts:206](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L206)\n\nCreate a div element with the specified CSS classes.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `classes` | `string`[] | array of CSS class names to add |\n| `parent?` | `HTMLElement` | optional parent element to append the div to |\n\n###### Returns\n\n`HTMLElement`\n\nthe created div element\n\n###### Example\n\n```ts\nconst div = Utils.createDiv(['grid-item', 'draggable']);\r\nconst nested = Utils.createDiv(['content'], parentDiv);\n```\n\n##### defaults()\n\n```ts\nstatic defaults(target, ...sources): object;\n```\n\nDefined in: [utils.ts:421](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L421)\n\nCopy unset fields from source objects to target object (shallow merge with defaults).\r\nSimilar to Object.assign but only sets undefined/null fields.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `target` | `any` | the object to copy defaults into |\n| ...`sources` | `any`[] | one or more source objects to copy defaults from |\n\n###### Returns\n\n`object`\n\nthe modified target object\n\n###### Example\n\n```ts\nconst config = { width: 100 };\r\nUtils.defaults(config, { width: 200, height: 50 });\r\n// config is now { width: 100, height: 50 }\n```\n\n##### find()\n\n```ts\nstatic find(nodes, id): GridStackNode;\n```\n\nDefined in: [utils.ts:332](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L332)\n\nFind a grid node by its ID.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `nodes` | [`GridStackNode`](#gridstacknode-2)[] | array of nodes to search |\n| `id` | `string` | the ID to search for |\n\n###### Returns\n\n[`GridStackNode`](#gridstacknode-2)\n\nthe node with matching ID, or undefined if not found\n\n###### Example\n\n```ts\nconst node = Utils.find(nodes, 'widget-1');\r\nif (node) console.log('Found node at:', node.x, node.y);\n```\n\n##### getElement()\n\n```ts\nstatic getElement(els, root): HTMLElement;\n```\n\nDefined in: [utils.ts:155](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L155)\n\nConvert a potential selector into a single HTML element.\r\nSimilar to getElements() but returns only the first match.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `els` | [`GridStackElement`](#gridstackelement) | `undefined` | selector string or HTMLElement |\n| `root` | `HTMLElement` \\| `Document` | `document` | optional root element to search within (defaults to document) |\n\n###### Returns\n\n`HTMLElement`\n\nthe first HTML element matching the selector, or null if not found\n\n###### Example\n\n```ts\nconst element = Utils.getElement('#myWidget');\r\nconst first = Utils.getElement('.grid-item');\n```\n\n##### getElements()\n\n```ts\nstatic getElements(els, root): HTMLElement[];\n```\n\nDefined in: [utils.ts:112](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L112)\n\nConvert a potential selector into an actual list of HTML elements.\r\nSupports CSS selectors, element references, and special ID handling.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `els` | [`GridStackElement`](#gridstackelement) | `undefined` | selector string, HTMLElement, or array of elements |\n| `root` | `HTMLElement` \\| `Document` | `document` | optional root element to search within (defaults to document, useful for shadow DOM) |\n\n###### Returns\n\n`HTMLElement`[]\n\narray of HTML elements matching the selector\n\n###### Example\n\n```ts\nconst elements = Utils.getElements('.grid-item');\r\nconst byId = Utils.getElements('#myWidget');\r\nconst fromShadow = Utils.getElements('.item', shadowRoot);\n```\n\n##### getValuesFromTransformedElement()\n\n```ts\nstatic getValuesFromTransformedElement(parent): DragTransform;\n```\n\nDefined in: [utils.ts:761](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L761)\n\ndefines an element that is used to get the offset and scale from grid transforms\r\nreturns the scale and offsets from said element\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `parent` | `HTMLElement` |\n\n###### Returns\n\n[`DragTransform`](#dragtransform)\n\n##### initEvent()\n\n```ts\nstatic initEvent<T>(e, info): T;\n```\n\nDefined in: [utils.ts:718](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L718)\n\n###### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `T` |\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `e` | `MouseEvent` \\| `DragEvent` |\n| `info` | \\{ `target?`: `EventTarget`; `type`: `string`; \\} |\n| `info.target?` | `EventTarget` |\n| `info.type` | `string` |\n\n###### Returns\n\n`T`\n\n##### isIntercepted()\n\n```ts\nstatic isIntercepted(a, b): boolean;\n```\n\nDefined in: [utils.ts:244](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L244)\n\nCheck if two grid positions overlap/intersect.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `a` | [`GridStackPosition`](#gridstackposition) | first position with x, y, w, h properties |\n| `b` | [`GridStackPosition`](#gridstackposition) | second position with x, y, w, h properties |\n\n###### Returns\n\n`boolean`\n\ntrue if the positions overlap\n\n###### Example\n\n```ts\nconst overlaps = Utils.isIntercepted(\r\n  {x: 0, y: 0, w: 2, h: 1},\r\n  {x: 1, y: 0, w: 2, h: 1}\r\n); // true - they overlap\n```\n\n##### isTouching()\n\n```ts\nstatic isTouching(a, b): boolean;\n```\n\nDefined in: [utils.ts:261](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L261)\n\nCheck if two grid positions are touching (edges or corners).\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `a` | [`GridStackPosition`](#gridstackposition) | first position |\n| `b` | [`GridStackPosition`](#gridstackposition) | second position |\n\n###### Returns\n\n`boolean`\n\ntrue if the positions are touching\n\n###### Example\n\n```ts\nconst touching = Utils.isTouching(\r\n  {x: 0, y: 0, w: 2, h: 1},\r\n  {x: 2, y: 0, w: 1, h: 1}\r\n); // true - they share an edge\n```\n\n##### lazyLoad()\n\n```ts\nstatic lazyLoad(n): boolean;\n```\n\nDefined in: [utils.ts:191](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L191)\n\nCheck if a widget should be lazy loaded based on node or grid settings.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `n` | [`GridStackNode`](#gridstacknode-2) | the grid node to check |\n\n###### Returns\n\n`boolean`\n\ntrue if the item should be lazy loaded\n\n###### Example\n\n```ts\nif (Utils.lazyLoad(node)) {\r\n  // Set up intersection observer for lazy loading\r\n}\n```\n\n##### parseHeight()\n\n```ts\nstatic parseHeight(val): HeightData;\n```\n\nDefined in: [utils.ts:388](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L388)\n\nParse a height value with units into numeric value and unit string.\r\nSupports px, em, rem, vh, vw, %, cm, mm units.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `val` | [`numberOrString`](#numberorstring) | height value as number or string with units |\n\n###### Returns\n\n[`HeightData`](#heightdata)\n\nobject with h (height) and unit properties\n\n###### Example\n\n```ts\nUtils.parseHeight('100px');  // {h: 100, unit: 'px'}\r\nUtils.parseHeight('2rem');   // {h: 2, unit: 'rem'}\r\nUtils.parseHeight(50);       // {h: 50, unit: 'px'}\n```\n\n##### removeInternalAndSame()\n\n```ts\nstatic removeInternalAndSame(a, b): void;\n```\n\nDefined in: [utils.ts:503](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L503)\n\nremoves field from the first object if same as the second objects (like diffing) and internal '_' for saving\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `a` | `unknown` |\n| `b` | `unknown` |\n\n###### Returns\n\n`void`\n\n##### removeInternalForSave()\n\n```ts\nstatic removeInternalForSave(n, removeEl): void;\n```\n\nDefined in: [utils.ts:520](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L520)\n\nremoves internal fields '_' and default values for saving\n\n###### Parameters\n\n| Parameter | Type | Default value |\n| ------ | ------ | ------ |\n| `n` | [`GridStackNode`](#gridstacknode-2) | `undefined` |\n| `removeEl` | `boolean` | `true` |\n\n###### Returns\n\n`void`\n\n##### removePositioningStyles()\n\n```ts\nstatic removePositioningStyles(el): void;\n```\n\nDefined in: [utils.ts:553](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L553)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `el` | `HTMLElement` |\n\n###### Returns\n\n`void`\n\n##### same()\n\n```ts\nstatic same(a, b): boolean;\n```\n\nDefined in: [utils.ts:450](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L450)\n\nCompare two objects for equality (shallow comparison).\r\nChecks if objects have the same fields and values at one level deep.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `a` | `unknown` | first object to compare |\n| `b` | `unknown` | second object to compare |\n\n###### Returns\n\n`boolean`\n\ntrue if objects have the same values\n\n###### Example\n\n```ts\nUtils.same({x: 1, y: 2}, {x: 1, y: 2}); // true\r\nUtils.same({x: 1}, {x: 1, y: 2}); // false\n```\n\n##### samePos()\n\n```ts\nstatic samePos(a, b): boolean;\n```\n\nDefined in: [utils.ts:489](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L489)\n\ntrue if a and b has same size & position\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `a` | [`GridStackPosition`](#gridstackposition) |\n| `b` | [`GridStackPosition`](#gridstackposition) |\n\n###### Returns\n\n`boolean`\n\n##### sanitizeMinMax()\n\n```ts\nstatic sanitizeMinMax(node): void;\n```\n\nDefined in: [utils.ts:494](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L494)\n\ngiven a node, makes sure it's min/max are valid\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `node` | [`GridStackNode`](#gridstacknode-2) |\n\n###### Returns\n\n`void`\n\n##### shouldSizeToContent()\n\n```ts\nstatic shouldSizeToContent(n, strict): boolean;\n```\n\nDefined in: [utils.ts:225](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L225)\n\nCheck if a widget should resize to fit its content.\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `n` | [`GridStackNode`](#gridstacknode-2) | `undefined` | the grid node to check (can be undefined) |\n| `strict` | `boolean` | `false` | if true, only returns true for explicit sizeToContent:true (not numbers) |\n\n###### Returns\n\n`boolean`\n\ntrue if the widget should resize to content\n\n###### Example\n\n```ts\nif (Utils.shouldSizeToContent(node)) {\r\n  // Trigger content-based resizing\r\n}\n```\n\n##### simulateMouseEvent()\n\n```ts\nstatic simulateMouseEvent(\n   e, \n   simulatedType, \n   target?): void;\n```\n\nDefined in: [utils.ts:734](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L734)\n\ncopies the MouseEvent (or convert Touch) properties and sends it as another event to the given target\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `e` | `MouseEvent` \\| `Touch` |\n| `simulatedType` | `string` |\n| `target?` | `EventTarget` |\n\n###### Returns\n\n`void`\n\n##### sort()\n\n```ts\nstatic sort(nodes, dir): GridStackNode[];\n```\n\nDefined in: [utils.ts:312](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L312)\n\nSort an array of grid nodes by position (y first, then x).\n\n###### Parameters\n\n| Parameter | Type | Default value | Description |\n| ------ | ------ | ------ | ------ |\n| `nodes` | [`GridStackNode`](#gridstacknode-2)[] | `undefined` | array of nodes to sort |\n| `dir` | `-1` \\| `1` | `1` | sort direction: 1 for ascending (top-left first), -1 for descending |\n\n###### Returns\n\n[`GridStackNode`](#gridstacknode-2)[]\n\nthe sorted array (modifies original)\n\n###### Example\n\n```ts\nconst sorted = Utils.sort(nodes); // Sort top-left to bottom-right\r\nconst reverse = Utils.sort(nodes, -1); // Sort bottom-right to top-left\n```\n\n##### swap()\n\n```ts\nstatic swap(\n   o, \n   a, \n   b): void;\n```\n\nDefined in: [utils.ts:785](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L785)\n\nswap the given object 2 field values\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `o` | `unknown` |\n| `a` | `string` |\n| `b` | `string` |\n\n###### Returns\n\n`void`\n\n##### throttle()\n\n```ts\nstatic throttle(func, delay): () => void;\n```\n\nDefined in: [utils.ts:543](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L543)\n\ndelay calling the given function for given delay, preventing new calls from happening while waiting\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `func` | () => `void` |\n| `delay` | `number` |\n\n###### Returns\n\n```ts\n(): void;\n```\n\n###### Returns\n\n`void`\n\n##### toBool()\n\n```ts\nstatic toBool(v): boolean;\n```\n\nDefined in: [utils.ts:350](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L350)\n\nConvert various value types to boolean.\r\nHandles strings like 'false', 'no', '0' as false.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `v` | `unknown` | value to convert |\n\n###### Returns\n\n`boolean`\n\nboolean representation\n\n###### Example\n\n```ts\nUtils.toBool('true');  // true\r\nUtils.toBool('false'); // false\r\nUtils.toBool('no');    // false\r\nUtils.toBool('1');     // true\n```\n\n##### toNumber()\n\n```ts\nstatic toNumber(value): number;\n```\n\nDefined in: [utils.ts:372](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L372)\n\nConvert a string value to a number, handling null and empty strings.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `value` | `string` | string or null value to convert |\n\n###### Returns\n\n`number`\n\nnumber value, or undefined for null/empty strings\n\n###### Example\n\n```ts\nUtils.toNumber('42');  // 42\r\nUtils.toNumber('');    // undefined\r\nUtils.toNumber(null);  // undefined\n```\n\n## Interfaces\n\n<a id=\"gridstackoptions\"></a>\n### GridStackOptions\n\nDefined in: [types.ts:184](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L184)\n\nDefines the options for a Grid\n\n#### Properties\n\n| Property | Type | Description | Defined in |\n| ------ | ------ | ------ | ------ |\n| <a id=\"acceptwidgets\"></a> `acceptWidgets?` | `string` \\| `boolean` \\| (`element`) => `boolean` | Accept widgets dragged from other grids or from outside (default: `false`). Can be: - `true`: will accept HTML elements having 'grid-stack-item' as class attribute - `false`: will not accept any external widgets - string: explicit class name to accept instead of default - function: callback called before an item will be accepted when entering a grid **Example** `// Accept all grid items acceptWidgets: true // Accept only items with specific class acceptWidgets: 'my-draggable-item' // Custom validation function acceptWidgets: (el) => { return el.getAttribute('data-accept') === 'true'; }` **See** [http://gridstack.github.io/gridstack.js/demo/two.html](http://gridstack.github.io/gridstack.js/demo/two.html) for complete example | [types.ts:206](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L206) |\n| <a id=\"alwaysshowresizehandle\"></a> `alwaysShowResizeHandle?` | `boolean` \\| `\"mobile\"` | possible values (default: `mobile`) - does not apply to non-resizable widgets `false` the resizing handles are only shown while hovering over a widget `true` the resizing handles are always shown 'mobile' if running on a mobile device, default to `true` (since there is no hovering per say), else `false`. See [example](http://gridstack.github.io/gridstack.js/demo/mobile.html) | [types.ts:213](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L213) |\n| <a id=\"animate\"></a> `animate?` | `boolean` | turns animation on (default?: true) | [types.ts:216](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L216) |\n| <a id=\"auto\"></a> `auto?` | `boolean` | if false gridstack will not initialize existing items (default?: true) | [types.ts:219](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L219) |\n| <a id=\"cellheight-3\"></a> `cellHeight?` | [`numberOrString`](#numberorstring) | One cell height (default: 'auto'). Can be: - an integer (px): fixed pixel height - a string (ex: '100px', '10em', '10rem'): CSS length value - 0: library will not generate styles for rows (define your own CSS) - 'auto': height calculated for square cells (width / column) and updated live on window resize - 'initial': similar to 'auto' but stays fixed size during window resizing Note: % values don't work correctly - see demo/cell-height.html **Example** `// Fixed 100px height cellHeight: 100 // CSS units cellHeight: '5rem' cellHeight: '100px' // Auto-sizing for square cells cellHeight: 'auto' // No CSS generation (custom styles) cellHeight: 0` | [types.ts:245](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L245) |\n| <a id=\"cellheightthrottle\"></a> `cellHeightThrottle?` | `number` | throttle time delay (in ms) used when cellHeight='auto' to improve performance vs usability (default?: 100). A value of 0 will make it instant at a cost of re-creating the CSS file at ever window resize event! | [types.ts:250](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L250) |\n| <a id=\"cellheightunit\"></a> `cellHeightUnit?` | `string` | (internal) unit for cellHeight (default? 'px') which is set when a string cellHeight with a unit is passed (ex: '10rem') | [types.ts:253](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L253) |\n| <a id=\"children\"></a> `children?` | [`GridStackWidget`](#gridstackwidget)[] | list of children item to create when calling load() or addGrid() | [types.ts:256](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L256) |\n| <a id=\"class\"></a> `class?` | `string` | additional class on top of '.grid-stack' (which is required for our CSS) to differentiate this instance. Note: only used by addGrid(), else your element should have the needed class | [types.ts:269](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L269) |\n| <a id=\"column-4\"></a> `column?` | `number` \\| `\"auto\"` | number of columns (default?: 12). Note: IF you change this, CSS also have to change. See https://github.com/gridstack/gridstack.js#change-grid-columns. Note: for nested grids, it is recommended to use 'auto' which will always match the container grid-item current width (in column) to keep inside and outside items always the same. flag is NOT supported for regular non-nested grids. | [types.ts:262](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L262) |\n| <a id=\"columnopts\"></a> `columnOpts?` | [`Responsive`](#responsive) | responsive column layout for width:column behavior | [types.ts:265](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L265) |\n| <a id=\"disabledrag\"></a> `disableDrag?` | `boolean` | disallows dragging of widgets (default?: false) | [types.ts:272](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L272) |\n| <a id=\"disableresize\"></a> `disableResize?` | `boolean` | disallows resizing of widgets (default?: false). | [types.ts:275](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L275) |\n| <a id=\"draggable-3\"></a> `draggable?` | [`DDDragOpt`](#dddragopt) | allows to override UI draggable options. (default?: { handle?: '.grid-stack-item-content', appendTo?: 'body' }) | [types.ts:278](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L278) |\n| <a id=\"engineclass-1\"></a> `engineClass?` | *typeof* [`GridStackEngine`](#gridstackengine-2) | the type of engine to create (so you can subclass) default to GridStackEngine | [types.ts:284](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L284) |\n| <a id=\"float-4\"></a> `float?` | `boolean` | enable floating widgets (default?: false) See example (http://gridstack.github.io/gridstack.js/demo/float.html) | [types.ts:287](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L287) |\n| <a id=\"handle-1\"></a> `handle?` | `string` | draggable handle selector (default?: '.grid-stack-item-content') | [types.ts:290](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L290) |\n| <a id=\"handleclass\"></a> `handleClass?` | `string` | draggable handle class (e.g. 'grid-stack-item-content'). If set 'handle' is ignored (default?: null) | [types.ts:293](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L293) |\n| <a id=\"itemclass\"></a> `itemClass?` | `string` | additional widget class (default?: 'grid-stack-item') | [types.ts:296](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L296) |\n| <a id=\"layout-1\"></a> `layout?` | [`ColumnOptions`](#columnoptions) | re-layout mode when we're a subgrid and we are being resized. default to 'list' | [types.ts:299](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L299) |\n| <a id=\"lazyload-1\"></a> `lazyLoad?` | `boolean` | true when widgets are only created when they scroll into view (visible) | [types.ts:302](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L302) |\n| <a id=\"margin-2\"></a> `margin?` | [`numberOrString`](#numberorstring) | gap between grid item and content (default?: 10). This will set all 4 sides and support the CSS formats below an integer (px) a string with possible units (ex: '2em', '20px', '2rem') string with space separated values (ex: '5px 10px 0 20px' for all 4 sides, or '5em 10em' for top/bottom and left/right pairs like CSS). Note: all sides must have same units (last one wins, default px) | [types.ts:311](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L311) |\n| <a id=\"marginbottom-1\"></a> `marginBottom?` | [`numberOrString`](#numberorstring) | - | [types.ts:316](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L316) |\n| <a id=\"marginleft-1\"></a> `marginLeft?` | [`numberOrString`](#numberorstring) | - | [types.ts:317](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L317) |\n| <a id=\"marginright-1\"></a> `marginRight?` | [`numberOrString`](#numberorstring) | - | [types.ts:315](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L315) |\n| <a id=\"margintop-1\"></a> `marginTop?` | [`numberOrString`](#numberorstring) | OLD way to optionally set each side - use margin: '5px 10px 0 20px' instead. Used internally to store each side. | [types.ts:314](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L314) |\n| <a id=\"marginunit\"></a> `marginUnit?` | `string` | (internal) unit for margin (default? 'px') set when `margin` is set as string with unit (ex: 2rem') | [types.ts:320](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L320) |\n| <a id=\"maxrow-2\"></a> `maxRow?` | `number` | maximum rows amount. Default? is 0 which means no maximum rows | [types.ts:323](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L323) |\n| <a id=\"minrow\"></a> `minRow?` | `number` | minimum rows amount which is handy to prevent grid from collapsing when empty. Default is `0`. When no set the `min-height` CSS attribute on the grid div (in pixels) can be used, which will round to the closest row. | [types.ts:328](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L328) |\n| <a id=\"nonce\"></a> `nonce?` | `string` | If you are using a nonce-based Content Security Policy, pass your nonce here and GridStack will add it to the `<style>` elements it creates. | [types.ts:332](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L332) |\n| <a id=\"placeholderclass\"></a> `placeholderClass?` | `string` | class for placeholder (default?: 'grid-stack-placeholder') | [types.ts:335](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L335) |\n| <a id=\"placeholdertext\"></a> `placeholderText?` | `string` | placeholder default content (default?: '') | [types.ts:338](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L338) |\n| <a id=\"removable\"></a> `removable?` | `string` \\| `boolean` | if true widgets could be removed by dragging outside of the grid. It could also be a selector string (ex: \".trash\"), in this case widgets will be removed by dropping them there (default?: false) See example (http://gridstack.github.io/gridstack.js/demo/two.html) | [types.ts:348](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L348) |\n| <a id=\"removableoptions\"></a> `removableOptions?` | [`DDRemoveOpt`](#ddremoveopt) | allows to override UI removable options. (default?: { accept: '.grid-stack-item' }) | [types.ts:351](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L351) |\n| <a id=\"resizable-4\"></a> `resizable?` | [`DDResizeOpt`](#ddresizeopt) | allows to override UI resizable options. default is { handles: 'se', autoHide: true on desktop, false on mobile } | [types.ts:341](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L341) |\n| <a id=\"row\"></a> `row?` | `number` | fix grid number of rows. This is a shortcut of writing `minRow:N, maxRow:N`. (default `0` no constrain) | [types.ts:354](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L354) |\n| <a id=\"rtl\"></a> `rtl?` | `boolean` \\| `\"auto\"` | if true turns grid to RTL. Possible values are true, false, 'auto' (default?: 'auto') See [example](http://gridstack.github.io/gridstack.js/demo/right-to-left(rtl).html) | [types.ts:360](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L360) |\n| <a id=\"sizetocontent-1\"></a> `sizeToContent?` | `boolean` | set to true if all grid items (by default, but item can also override) height should be based on content size instead of WidgetItem.h to avoid v-scrollbars. Note: this is still row based, not pixels, so it will use ceil(getBoundingClientRect().height / getCellHeight()) | [types.ts:365](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L365) |\n| <a id=\"staticgrid\"></a> `staticGrid?` | `boolean` | makes grid static (default?: false). If `true` widgets are not movable/resizable. You don't even need draggable/resizable. A CSS class 'grid-stack-static' is also added to the element. | [types.ts:372](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L372) |\n| <a id=\"styleinhead\"></a> ~~`styleInHead?`~~ | `boolean` | **Deprecated** Not used anymore, styles are now implemented with local CSS variables | [types.ts:377](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L377) |\n| <a id=\"subgriddynamic\"></a> `subGridDynamic?` | `boolean` | enable/disable the creation of sub-grids on the fly by dragging items completely over others (nest) vs partially (push). Forces `DDDragOpt.pause=true` to accomplish that. | [types.ts:384](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L384) |\n| <a id=\"subgridopts-1\"></a> `subGridOpts?` | [`GridStackOptions`](#gridstackoptions) | list of differences in options for automatically created sub-grids under us (inside our grid-items) | [types.ts:380](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L380) |\n\n***\n\n<a id=\"abstract-ddbaseimplement\"></a>\n### `abstract` DDBaseImplement\n\nDefined in: [dd-base-impl.ts:17](https://github.com/adumesny/gridstack.js/blob/master/src/dd-base-impl.ts#L17)\n\nAbstract base class for all drag & drop implementations.\nProvides common functionality for event handling, enable/disable state,\nand lifecycle management used by draggable, droppable, and resizable implementations.\n\n#### Extended by\n\n- [`DDDraggable`](#dddraggable)\n- [`DDDroppable`](#dddroppable)\n- [`DDResizable`](#ddresizable-1)\n\n#### Accessors\n\n##### disabled\n\n###### Get Signature\n\n```ts\nget disabled(): boolean;\n```\n\nDefined in: [dd-base-impl.ts:22](https://github.com/adumesny/gridstack.js/blob/master/src/dd-base-impl.ts#L22)\n\nReturns the current disabled state.\nNote: Use enable()/disable() methods to change state as other operations need to happen.\n\n###### Returns\n\n`boolean`\n\n#### Constructors\n\n##### Constructor\n\n```ts\nnew DDBaseImplement(): DDBaseImplement;\n```\n\n###### Returns\n\n[`DDBaseImplement`](#ddbaseimplement)\n\n#### Methods\n\n##### destroy()\n\n```ts\ndestroy(): void;\n```\n\nDefined in: [dd-base-impl.ts:70](https://github.com/adumesny/gridstack.js/blob/master/src/dd-base-impl.ts#L70)\n\nDestroy this drag & drop implementation and clean up resources.\nRemoves all event handlers and clears internal state.\n\n###### Returns\n\n`void`\n\n##### disable()\n\n```ts\ndisable(): void;\n```\n\nDefined in: [dd-base-impl.ts:62](https://github.com/adumesny/gridstack.js/blob/master/src/dd-base-impl.ts#L62)\n\nDisable this drag & drop implementation.\nSubclasses should override to perform additional cleanup.\n\n###### Returns\n\n`void`\n\n##### enable()\n\n```ts\nenable(): void;\n```\n\nDefined in: [dd-base-impl.ts:54](https://github.com/adumesny/gridstack.js/blob/master/src/dd-base-impl.ts#L54)\n\nEnable this drag & drop implementation.\nSubclasses should override to perform additional setup.\n\n###### Returns\n\n`void`\n\n##### off()\n\n```ts\noff(event): void;\n```\n\nDefined in: [dd-base-impl.ts:46](https://github.com/adumesny/gridstack.js/blob/master/src/dd-base-impl.ts#L46)\n\nUnregister an event callback for the specified event.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `event` | `string` | Event name to stop listening for |\n\n###### Returns\n\n`void`\n\n##### on()\n\n```ts\non(event, callback): void;\n```\n\nDefined in: [dd-base-impl.ts:37](https://github.com/adumesny/gridstack.js/blob/master/src/dd-base-impl.ts#L37)\n\nRegister an event callback for the specified event.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `event` | `string` | Event name to listen for |\n| `callback` | [`EventCallback`](#eventcallback) | Function to call when event occurs |\n\n###### Returns\n\n`void`\n\n##### triggerEvent()\n\n```ts\ntriggerEvent(eventName, event): boolean | void;\n```\n\nDefined in: [dd-base-impl.ts:81](https://github.com/adumesny/gridstack.js/blob/master/src/dd-base-impl.ts#L81)\n\nTrigger a registered event callback if one exists and the implementation is enabled.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `eventName` | `string` | Name of the event to trigger |\n| `event` | `Event` | DOM event object to pass to the callback |\n\n###### Returns\n\n`boolean` \\| `void`\n\nResult from the callback function, if any\n\n***\n\n<a id=\"dddraggable\"></a>\n### DDDraggable\n\nDefined in: [dd-draggable.ts:34](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L34)\n\nInterface for HTML elements extended with drag & drop options.\nUsed to associate DD configuration with DOM elements.\n\n#### Extends\n\n- [`DDBaseImplement`](#ddbaseimplement)\n\n#### Implements\n\n- [`HTMLElementExtendOpt`](#htmlelementextendopt)\\<[`DDDragOpt`](#dddragopt)\\>\n\n#### Accessors\n\n##### disabled\n\n###### Get Signature\n\n```ts\nget disabled(): boolean;\n```\n\nDefined in: [dd-base-impl.ts:22](https://github.com/adumesny/gridstack.js/blob/master/src/dd-base-impl.ts#L22)\n\nReturns the current disabled state.\nNote: Use enable()/disable() methods to change state as other operations need to happen.\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n[`DDBaseImplement`](#ddbaseimplement).[`disabled`](#disabled)\n\n#### Constructors\n\n##### Constructor\n\n```ts\nnew DDDraggable(el, option): DDDraggable;\n```\n\nDefined in: [dd-draggable.ts:65](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L65)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `el` | [`GridItemHTMLElement`](#griditemhtmlelement) |\n| `option` | [`DDDragOpt`](#dddragopt) |\n\n###### Returns\n\n[`DDDraggable`](#dddraggable)\n\n###### Overrides\n\n[`DDBaseImplement`](#ddbaseimplement).[`constructor`](#constructor)\n\n#### Methods\n\n##### destroy()\n\n```ts\ndestroy(): void;\n```\n\nDefined in: [dd-draggable.ts:118](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L118)\n\nDestroy this drag & drop implementation and clean up resources.\nRemoves all event handlers and clears internal state.\n\n###### Returns\n\n`void`\n\n###### Overrides\n\n[`DDBaseImplement`](#ddbaseimplement).[`destroy`](#destroy)\n\n##### disable()\n\n```ts\ndisable(forDestroy): void;\n```\n\nDefined in: [dd-draggable.ts:105](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L105)\n\nDisable this drag & drop implementation.\nSubclasses should override to perform additional cleanup.\n\n###### Parameters\n\n| Parameter | Type | Default value |\n| ------ | ------ | ------ |\n| `forDestroy` | `boolean` | `false` |\n\n###### Returns\n\n`void`\n\n###### Overrides\n\n[`DDBaseImplement`](#ddbaseimplement).[`disable`](#disable)\n\n##### enable()\n\n```ts\nenable(): void;\n```\n\nDefined in: [dd-draggable.ts:91](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L91)\n\nEnable this drag & drop implementation.\nSubclasses should override to perform additional setup.\n\n###### Returns\n\n`void`\n\n###### Overrides\n\n[`DDBaseImplement`](#ddbaseimplement).[`enable`](#enable)\n\n##### off()\n\n```ts\noff(event): void;\n```\n\nDefined in: [dd-draggable.ts:87](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L87)\n\nUnregister an event callback for the specified event.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `event` | `DDDragEvent` | Event name to stop listening for |\n\n###### Returns\n\n`void`\n\n###### Overrides\n\n[`DDBaseImplement`](#ddbaseimplement).[`off`](#off)\n\n##### on()\n\n```ts\non(event, callback): void;\n```\n\nDefined in: [dd-draggable.ts:83](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L83)\n\nRegister an event callback for the specified event.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `event` | `DDDragEvent` | Event name to listen for |\n| `callback` | (`event`) => `void` | Function to call when event occurs |\n\n###### Returns\n\n`void`\n\n###### Overrides\n\n[`DDBaseImplement`](#ddbaseimplement).[`on`](#on)\n\n##### triggerEvent()\n\n```ts\ntriggerEvent(eventName, event): boolean | void;\n```\n\nDefined in: [dd-base-impl.ts:81](https://github.com/adumesny/gridstack.js/blob/master/src/dd-base-impl.ts#L81)\n\nTrigger a registered event callback if one exists and the implementation is enabled.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `eventName` | `string` | Name of the event to trigger |\n| `event` | `Event` | DOM event object to pass to the callback |\n\n###### Returns\n\n`boolean` \\| `void`\n\nResult from the callback function, if any\n\n###### Inherited from\n\n[`DDBaseImplement`](#ddbaseimplement).[`triggerEvent`](#triggerevent)\n\n##### updateOption()\n\n```ts\nupdateOption(opts): DDDraggable;\n```\n\nDefined in: [dd-draggable.ts:129](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L129)\n\nMethod to update the options and return the DD implementation\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts` | [`DDDragOpt`](#dddragopt) |\n\n###### Returns\n\n[`DDDraggable`](#dddraggable)\n\n###### Implementation of\n\n[`HTMLElementExtendOpt`](#htmlelementextendopt).[`updateOption`](#updateoption-6)\n\n#### Properties\n\n| Property | Modifier | Type | Default value | Description | Defined in |\n| ------ | ------ | ------ | ------ | ------ | ------ |\n| <a id=\"el\"></a> `el` | `public` | [`GridItemHTMLElement`](#griditemhtmlelement) | `undefined` | The HTML element being extended | [dd-draggable.ts:65](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L65) |\n| <a id=\"helper\"></a> `helper` | `public` | `HTMLElement` | `undefined` | - | [dd-draggable.ts:35](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L35) |\n| <a id=\"option\"></a> `option` | `public` | [`DDDragOpt`](#dddragopt) | `{}` | The drag & drop options/configuration | [dd-draggable.ts:65](https://github.com/adumesny/gridstack.js/blob/master/src/dd-draggable.ts#L65) |\n\n***\n\n<a id=\"dddroppable\"></a>\n### DDDroppable\n\nDefined in: [dd-droppable.ts:23](https://github.com/adumesny/gridstack.js/blob/master/src/dd-droppable.ts#L23)\n\nInterface for HTML elements extended with drag & drop options.\nUsed to associate DD configuration with DOM elements.\n\n#### Extends\n\n- [`DDBaseImplement`](#ddbaseimplement)\n\n#### Implements\n\n- [`HTMLElementExtendOpt`](#htmlelementextendopt)\\<[`DDDroppableOpt`](#dddroppableopt)\\>\n\n#### Accessors\n\n##### disabled\n\n###### Get Signature\n\n```ts\nget disabled(): boolean;\n```\n\nDefined in: [dd-base-impl.ts:22](https://github.com/adumesny/gridstack.js/blob/master/src/dd-base-impl.ts#L22)\n\nReturns the current disabled state.\nNote: Use enable()/disable() methods to change state as other operations need to happen.\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n[`DDBaseImplement`](#ddbaseimplement).[`disabled`](#disabled)\n\n#### Constructors\n\n##### Constructor\n\n```ts\nnew DDDroppable(el, option): DDDroppable;\n```\n\nDefined in: [dd-droppable.ts:27](https://github.com/adumesny/gridstack.js/blob/master/src/dd-droppable.ts#L27)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `el` | `HTMLElement` |\n| `option` | [`DDDroppableOpt`](#dddroppableopt) |\n\n###### Returns\n\n[`DDDroppable`](#dddroppable)\n\n###### Overrides\n\n[`DDBaseImplement`](#ddbaseimplement).[`constructor`](#constructor)\n\n#### Methods\n\n##### destroy()\n\n```ts\ndestroy(): void;\n```\n\nDefined in: [dd-droppable.ts:70](https://github.com/adumesny/gridstack.js/blob/master/src/dd-droppable.ts#L70)\n\nDestroy this drag & drop implementation and clean up resources.\nRemoves all event handlers and clears internal state.\n\n###### Returns\n\n`void`\n\n###### Overrides\n\n[`DDBaseImplement`](#ddbaseimplement).[`destroy`](#destroy)\n\n##### disable()\n\n```ts\ndisable(forDestroy): void;\n```\n\nDefined in: [dd-droppable.ts:57](https://github.com/adumesny/gridstack.js/blob/master/src/dd-droppable.ts#L57)\n\nDisable this drag & drop implementation.\nSubclasses should override to perform additional cleanup.\n\n###### Parameters\n\n| Parameter | Type | Default value |\n| ------ | ------ | ------ |\n| `forDestroy` | `boolean` | `false` |\n\n###### Returns\n\n`void`\n\n###### Overrides\n\n[`DDBaseImplement`](#ddbaseimplement).[`disable`](#disable)\n\n##### drop()\n\n```ts\ndrop(e): void;\n```\n\nDefined in: [dd-droppable.ts:143](https://github.com/adumesny/gridstack.js/blob/master/src/dd-droppable.ts#L143)\n\nitem is being dropped on us - called by the drag mouseup handler - this calls the client drop event\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `e` | `MouseEvent` |\n\n###### Returns\n\n`void`\n\n##### enable()\n\n```ts\nenable(): void;\n```\n\nDefined in: [dd-droppable.ts:44](https://github.com/adumesny/gridstack.js/blob/master/src/dd-droppable.ts#L44)\n\nEnable this drag & drop implementation.\nSubclasses should override to perform additional setup.\n\n###### Returns\n\n`void`\n\n###### Overrides\n\n[`DDBaseImplement`](#ddbaseimplement).[`enable`](#enable)\n\n##### off()\n\n```ts\noff(event): void;\n```\n\nDefined in: [dd-droppable.ts:40](https://github.com/adumesny/gridstack.js/blob/master/src/dd-droppable.ts#L40)\n\nUnregister an event callback for the specified event.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `event` | `\"drop\"` \\| `\"dropover\"` \\| `\"dropout\"` | Event name to stop listening for |\n\n###### Returns\n\n`void`\n\n###### Overrides\n\n[`DDBaseImplement`](#ddbaseimplement).[`off`](#off)\n\n##### on()\n\n```ts\non(event, callback): void;\n```\n\nDefined in: [dd-droppable.ts:36](https://github.com/adumesny/gridstack.js/blob/master/src/dd-droppable.ts#L36)\n\nRegister an event callback for the specified event.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `event` | `\"drop\"` \\| `\"dropover\"` \\| `\"dropout\"` | Event name to listen for |\n| `callback` | (`event`) => `void` | Function to call when event occurs |\n\n###### Returns\n\n`void`\n\n###### Overrides\n\n[`DDBaseImplement`](#ddbaseimplement).[`on`](#on)\n\n##### triggerEvent()\n\n```ts\ntriggerEvent(eventName, event): boolean | void;\n```\n\nDefined in: [dd-base-impl.ts:81](https://github.com/adumesny/gridstack.js/blob/master/src/dd-base-impl.ts#L81)\n\nTrigger a registered event callback if one exists and the implementation is enabled.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `eventName` | `string` | Name of the event to trigger |\n| `event` | `Event` | DOM event object to pass to the callback |\n\n###### Returns\n\n`boolean` \\| `void`\n\nResult from the callback function, if any\n\n###### Inherited from\n\n[`DDBaseImplement`](#ddbaseimplement).[`triggerEvent`](#triggerevent)\n\n##### updateOption()\n\n```ts\nupdateOption(opts): DDDroppable;\n```\n\nDefined in: [dd-droppable.ts:77](https://github.com/adumesny/gridstack.js/blob/master/src/dd-droppable.ts#L77)\n\nMethod to update the options and return the DD implementation\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts` | [`DDDroppableOpt`](#dddroppableopt) |\n\n###### Returns\n\n[`DDDroppable`](#dddroppable)\n\n###### Implementation of\n\n[`HTMLElementExtendOpt`](#htmlelementextendopt).[`updateOption`](#updateoption-6)\n\n#### Properties\n\n| Property | Modifier | Type | Default value | Description | Defined in |\n| ------ | ------ | ------ | ------ | ------ | ------ |\n| <a id=\"accept-1\"></a> `accept` | `public` | (`el`) => `boolean` | `undefined` | - | [dd-droppable.ts:25](https://github.com/adumesny/gridstack.js/blob/master/src/dd-droppable.ts#L25) |\n| <a id=\"el-1\"></a> `el` | `public` | `HTMLElement` | `undefined` | The HTML element being extended | [dd-droppable.ts:27](https://github.com/adumesny/gridstack.js/blob/master/src/dd-droppable.ts#L27) |\n| <a id=\"option-1\"></a> `option` | `public` | [`DDDroppableOpt`](#dddroppableopt) | `{}` | The drag & drop options/configuration | [dd-droppable.ts:27](https://github.com/adumesny/gridstack.js/blob/master/src/dd-droppable.ts#L27) |\n\n***\n\n<a id=\"ddelement\"></a>\n### DDElement\n\nDefined in: [dd-element.ts:15](https://github.com/adumesny/gridstack.js/blob/master/src/dd-element.ts#L15)\n\n#### Constructors\n\n##### Constructor\n\n```ts\nnew DDElement(el): DDElement;\n```\n\nDefined in: [dd-element.ts:26](https://github.com/adumesny/gridstack.js/blob/master/src/dd-element.ts#L26)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `el` | [`DDElementHost`](#ddelementhost) |\n\n###### Returns\n\n[`DDElement`](#ddelement)\n\n#### Methods\n\n##### cleanDraggable()\n\n```ts\ncleanDraggable(): DDElement;\n```\n\nDefined in: [dd-element.ts:59](https://github.com/adumesny/gridstack.js/blob/master/src/dd-element.ts#L59)\n\n###### Returns\n\n[`DDElement`](#ddelement)\n\n##### cleanDroppable()\n\n```ts\ncleanDroppable(): DDElement;\n```\n\nDefined in: [dd-element.ts:93](https://github.com/adumesny/gridstack.js/blob/master/src/dd-element.ts#L93)\n\n###### Returns\n\n[`DDElement`](#ddelement)\n\n##### cleanResizable()\n\n```ts\ncleanResizable(): DDElement;\n```\n\nDefined in: [dd-element.ts:76](https://github.com/adumesny/gridstack.js/blob/master/src/dd-element.ts#L76)\n\n###### Returns\n\n[`DDElement`](#ddelement)\n\n##### init()\n\n```ts\nstatic init(el): DDElement;\n```\n\nDefined in: [dd-element.ts:17](https://github.com/adumesny/gridstack.js/blob/master/src/dd-element.ts#L17)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `el` | [`DDElementHost`](#ddelementhost) |\n\n###### Returns\n\n[`DDElement`](#ddelement)\n\n##### off()\n\n```ts\noff(eventName): DDElement;\n```\n\nDefined in: [dd-element.ts:39](https://github.com/adumesny/gridstack.js/blob/master/src/dd-element.ts#L39)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `eventName` | `string` |\n\n###### Returns\n\n[`DDElement`](#ddelement)\n\n##### on()\n\n```ts\non(eventName, callback): DDElement;\n```\n\nDefined in: [dd-element.ts:28](https://github.com/adumesny/gridstack.js/blob/master/src/dd-element.ts#L28)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `eventName` | `string` |\n| `callback` | (`event`) => `void` |\n\n###### Returns\n\n[`DDElement`](#ddelement)\n\n##### setupDraggable()\n\n```ts\nsetupDraggable(opts): DDElement;\n```\n\nDefined in: [dd-element.ts:50](https://github.com/adumesny/gridstack.js/blob/master/src/dd-element.ts#L50)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts` | [`DDDragOpt`](#dddragopt) |\n\n###### Returns\n\n[`DDElement`](#ddelement)\n\n##### setupDroppable()\n\n```ts\nsetupDroppable(opts): DDElement;\n```\n\nDefined in: [dd-element.ts:84](https://github.com/adumesny/gridstack.js/blob/master/src/dd-element.ts#L84)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts` | [`DDDroppableOpt`](#dddroppableopt) |\n\n###### Returns\n\n[`DDElement`](#ddelement)\n\n##### setupResizable()\n\n```ts\nsetupResizable(opts): DDElement;\n```\n\nDefined in: [dd-element.ts:67](https://github.com/adumesny/gridstack.js/blob/master/src/dd-element.ts#L67)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts` | [`DDResizableOpt`](#ddresizableopt) |\n\n###### Returns\n\n[`DDElement`](#ddelement)\n\n#### Properties\n\n| Property | Modifier | Type | Defined in |\n| ------ | ------ | ------ | ------ |\n| <a id=\"dddraggable-1\"></a> `ddDraggable?` | `public` | [`DDDraggable`](#dddraggable) | [dd-element.ts:22](https://github.com/adumesny/gridstack.js/blob/master/src/dd-element.ts#L22) |\n| <a id=\"dddroppable-1\"></a> `ddDroppable?` | `public` | [`DDDroppable`](#dddroppable) | [dd-element.ts:23](https://github.com/adumesny/gridstack.js/blob/master/src/dd-element.ts#L23) |\n| <a id=\"ddresizable\"></a> `ddResizable?` | `public` | [`DDResizable`](#ddresizable-1) | [dd-element.ts:24](https://github.com/adumesny/gridstack.js/blob/master/src/dd-element.ts#L24) |\n| <a id=\"el-2\"></a> `el` | `public` | [`DDElementHost`](#ddelementhost) | [dd-element.ts:26](https://github.com/adumesny/gridstack.js/blob/master/src/dd-element.ts#L26) |\n\n***\n\n<a id=\"ddgridstack\"></a>\n### DDGridStack\n\nDefined in: [dd-gridstack.ts:57](https://github.com/adumesny/gridstack.js/blob/master/src/dd-gridstack.ts#L57)\n\nHTML Native Mouse and Touch Events Drag and Drop functionality.\n\nThis class provides the main drag & drop implementation for GridStack,\r\nhandling resizing, dragging, and dropping of grid items using native HTML5 events.\r\nIt manages the interaction between different DD components and the grid system.\n\n#### Constructors\n\n##### Constructor\n\n```ts\nnew DDGridStack(): DDGridStack;\n```\n\n###### Returns\n\n[`DDGridStack`](#ddgridstack)\n\n#### Methods\n\n##### draggable()\n\n```ts\ndraggable(\n   el, \n   opts, \n   key?, \n   value?): DDGridStack;\n```\n\nDefined in: [dd-gridstack.ts:120](https://github.com/adumesny/gridstack.js/blob/master/src/dd-gridstack.ts#L120)\n\nEnable/disable/configure dragging for grid elements.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `el` | [`GridItemHTMLElement`](#griditemhtmlelement) | Grid item element(s) to configure |\n| `opts` | `any` | Drag options or command ('enable', 'disable', 'destroy', 'option', or config object) |\n| `key?` | [`DDKey`](#ddkey) | Option key when using 'option' command |\n| `value?` | [`DDValue`](#ddvalue) | Option value when using 'option' command |\n\n###### Returns\n\n[`DDGridStack`](#ddgridstack)\n\nthis instance for chaining\n\n###### Example\n\n```ts\ndd.draggable(element, 'enable');  // Enable dragging\r\ndd.draggable(element, {handle: '.drag-handle'});  // Configure drag handle\n```\n\n##### dragIn()\n\n```ts\ndragIn(el, opts): DDGridStack;\n```\n\nDefined in: [dd-gridstack.ts:144](https://github.com/adumesny/gridstack.js/blob/master/src/dd-gridstack.ts#L144)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `el` | [`GridStackElement`](#gridstackelement) |\n| `opts` | [`DDDragOpt`](#dddragopt) |\n\n###### Returns\n\n[`DDGridStack`](#ddgridstack)\n\n##### droppable()\n\n```ts\ndroppable(\n   el, \n   opts, \n   key?, \n   value?): DDGridStack;\n```\n\nDefined in: [dd-gridstack.ts:149](https://github.com/adumesny/gridstack.js/blob/master/src/dd-gridstack.ts#L149)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `el` | [`GridItemHTMLElement`](#griditemhtmlelement) |\n| `opts` | `any` |\n| `key?` | [`DDKey`](#ddkey) |\n| `value?` | [`DDValue`](#ddvalue) |\n\n###### Returns\n\n[`DDGridStack`](#ddgridstack)\n\n##### isDraggable()\n\n```ts\nisDraggable(el): boolean;\n```\n\nDefined in: [dd-gridstack.ts:174](https://github.com/adumesny/gridstack.js/blob/master/src/dd-gridstack.ts#L174)\n\ntrue if element is draggable\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `el` | [`DDElementHost`](#ddelementhost) |\n\n###### Returns\n\n`boolean`\n\n##### isDroppable()\n\n```ts\nisDroppable(el): boolean;\n```\n\nDefined in: [dd-gridstack.ts:169](https://github.com/adumesny/gridstack.js/blob/master/src/dd-gridstack.ts#L169)\n\ntrue if element is droppable\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `el` | [`DDElementHost`](#ddelementhost) |\n\n###### Returns\n\n`boolean`\n\n##### isResizable()\n\n```ts\nisResizable(el): boolean;\n```\n\nDefined in: [dd-gridstack.ts:179](https://github.com/adumesny/gridstack.js/blob/master/src/dd-gridstack.ts#L179)\n\ntrue if element is draggable\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `el` | [`DDElementHost`](#ddelementhost) |\n\n###### Returns\n\n`boolean`\n\n##### off()\n\n```ts\noff(el, name): DDGridStack;\n```\n\nDefined in: [dd-gridstack.ts:195](https://github.com/adumesny/gridstack.js/blob/master/src/dd-gridstack.ts#L195)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `el` | [`GridItemHTMLElement`](#griditemhtmlelement) |\n| `name` | `string` |\n\n###### Returns\n\n[`DDGridStack`](#ddgridstack)\n\n##### on()\n\n```ts\non(\n   el, \n   name, \n   callback): DDGridStack;\n```\n\nDefined in: [dd-gridstack.ts:183](https://github.com/adumesny/gridstack.js/blob/master/src/dd-gridstack.ts#L183)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `el` | [`GridItemHTMLElement`](#griditemhtmlelement) |\n| `name` | `string` |\n| `callback` | [`DDCallback`](#ddcallback) |\n\n###### Returns\n\n[`DDGridStack`](#ddgridstack)\n\n##### resizable()\n\n```ts\nresizable(\n   el, \n   opts, \n   key?, \n   value?): DDGridStack;\n```\n\nDefined in: [dd-gridstack.ts:72](https://github.com/adumesny/gridstack.js/blob/master/src/dd-gridstack.ts#L72)\n\nEnable/disable/configure resizing for grid elements.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `el` | [`GridItemHTMLElement`](#griditemhtmlelement) | Grid item element(s) to configure |\n| `opts` | `any` | Resize options or command ('enable', 'disable', 'destroy', 'option', or config object) |\n| `key?` | [`DDKey`](#ddkey) | Option key when using 'option' command |\n| `value?` | [`DDValue`](#ddvalue) | Option value when using 'option' command |\n\n###### Returns\n\n[`DDGridStack`](#ddgridstack)\n\nthis instance for chaining\n\n###### Example\n\n```ts\ndd.resizable(element, 'enable');  // Enable resizing\r\ndd.resizable(element, 'option', 'minWidth', 100);  // Set minimum width\n```\n\n***\n\n<a id=\"ddmanager\"></a>\n### DDManager\n\nDefined in: [dd-manager.ts:17](https://github.com/adumesny/gridstack.js/blob/master/src/dd-manager.ts#L17)\n\nGlobal state manager for all Drag & Drop instances.\n\nThis class maintains shared state across all drag & drop operations,\nensuring proper coordination between multiple grids and drag/drop elements.\nAll properties are static to provide global access throughout the DD system.\n\n#### Constructors\n\n##### Constructor\n\n```ts\nnew DDManager(): DDManager;\n```\n\n###### Returns\n\n[`DDManager`](#ddmanager)\n\n#### Properties\n\n| Property | Modifier | Type | Description | Defined in |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"dragelement\"></a> `dragElement` | `static` | [`DDDraggable`](#dddraggable) | Reference to the element currently being dragged. Used to track the active drag operation across the system. | [dd-manager.ts:36](https://github.com/adumesny/gridstack.js/blob/master/src/dd-manager.ts#L36) |\n| <a id=\"dropelement\"></a> `dropElement` | `static` | [`DDDroppable`](#dddroppable) | Reference to the drop target element currently under the cursor. Used to handle drop operations and hover effects. | [dd-manager.ts:42](https://github.com/adumesny/gridstack.js/blob/master/src/dd-manager.ts#L42) |\n| <a id=\"mousehandled\"></a> `mouseHandled` | `static` | `boolean` | Flag indicating if a mouse down event was already handled. Prevents multiple handlers from processing the same mouse event. | [dd-manager.ts:30](https://github.com/adumesny/gridstack.js/blob/master/src/dd-manager.ts#L30) |\n| <a id=\"overresizeelement\"></a> `overResizeElement` | `static` | [`DDResizable`](#ddresizable-1) | Reference to the element currently being resized. Helps ignore nested grid resize handles during resize operations. | [dd-manager.ts:48](https://github.com/adumesny/gridstack.js/blob/master/src/dd-manager.ts#L48) |\n| <a id=\"pausedrag\"></a> `pauseDrag` | `static` | `number` \\| `boolean` | Controls drag operation pausing behavior. If set to true or a number (milliseconds), dragging placement and collision detection will only happen after the user pauses movement. This improves performance during rapid mouse movements. | [dd-manager.ts:24](https://github.com/adumesny/gridstack.js/blob/master/src/dd-manager.ts#L24) |\n\n***\n\n<a id=\"ddresizable-1\"></a>\n### DDResizable\n\nDefined in: [dd-resizable.ts:32](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L32)\n\nInterface for HTML elements extended with drag & drop options.\nUsed to associate DD configuration with DOM elements.\n\n#### Extends\n\n- [`DDBaseImplement`](#ddbaseimplement)\n\n#### Implements\n\n- [`HTMLElementExtendOpt`](#htmlelementextendopt)\\<[`DDResizableOpt`](#ddresizableopt)\\>\n\n#### Accessors\n\n##### disabled\n\n###### Get Signature\n\n```ts\nget disabled(): boolean;\n```\n\nDefined in: [dd-base-impl.ts:22](https://github.com/adumesny/gridstack.js/blob/master/src/dd-base-impl.ts#L22)\n\nReturns the current disabled state.\nNote: Use enable()/disable() methods to change state as other operations need to happen.\n\n###### Returns\n\n`boolean`\n\n###### Inherited from\n\n[`DDBaseImplement`](#ddbaseimplement).[`disabled`](#disabled)\n\n#### Constructors\n\n##### Constructor\n\n```ts\nnew DDResizable(el, option): DDResizable;\n```\n\nDefined in: [dd-resizable.ts:59](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L59)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `el` | [`GridItemHTMLElement`](#griditemhtmlelement) |\n| `option` | [`DDResizableOpt`](#ddresizableopt) |\n\n###### Returns\n\n[`DDResizable`](#ddresizable-1)\n\n###### Overrides\n\n[`DDBaseImplement`](#ddbaseimplement).[`constructor`](#constructor)\n\n#### Methods\n\n##### destroy()\n\n```ts\ndestroy(): void;\n```\n\nDefined in: [dd-resizable.ts:89](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L89)\n\nDestroy this drag & drop implementation and clean up resources.\nRemoves all event handlers and clears internal state.\n\n###### Returns\n\n`void`\n\n###### Overrides\n\n[`DDBaseImplement`](#ddbaseimplement).[`destroy`](#destroy)\n\n##### disable()\n\n```ts\ndisable(): void;\n```\n\nDefined in: [dd-resizable.ts:83](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L83)\n\nDisable this drag & drop implementation.\nSubclasses should override to perform additional cleanup.\n\n###### Returns\n\n`void`\n\n###### Overrides\n\n[`DDBaseImplement`](#ddbaseimplement).[`disable`](#disable)\n\n##### enable()\n\n```ts\nenable(): void;\n```\n\nDefined in: [dd-resizable.ts:77](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L77)\n\nEnable this drag & drop implementation.\nSubclasses should override to perform additional setup.\n\n###### Returns\n\n`void`\n\n###### Overrides\n\n[`DDBaseImplement`](#ddbaseimplement).[`enable`](#enable)\n\n##### off()\n\n```ts\noff(event): void;\n```\n\nDefined in: [dd-resizable.ts:73](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L73)\n\nUnregister an event callback for the specified event.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `event` | `\"resize\"` \\| `\"resizestart\"` \\| `\"resizestop\"` | Event name to stop listening for |\n\n###### Returns\n\n`void`\n\n###### Overrides\n\n[`DDBaseImplement`](#ddbaseimplement).[`off`](#off)\n\n##### on()\n\n```ts\non(event, callback): void;\n```\n\nDefined in: [dd-resizable.ts:69](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L69)\n\nRegister an event callback for the specified event.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `event` | `\"resize\"` \\| `\"resizestart\"` \\| `\"resizestop\"` | Event name to listen for |\n| `callback` | (`event`) => `void` | Function to call when event occurs |\n\n###### Returns\n\n`void`\n\n###### Overrides\n\n[`DDBaseImplement`](#ddbaseimplement).[`on`](#on)\n\n##### triggerEvent()\n\n```ts\ntriggerEvent(eventName, event): boolean | void;\n```\n\nDefined in: [dd-base-impl.ts:81](https://github.com/adumesny/gridstack.js/blob/master/src/dd-base-impl.ts#L81)\n\nTrigger a registered event callback if one exists and the implementation is enabled.\n\n###### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `eventName` | `string` | Name of the event to trigger |\n| `event` | `Event` | DOM event object to pass to the callback |\n\n###### Returns\n\n`boolean` \\| `void`\n\nResult from the callback function, if any\n\n###### Inherited from\n\n[`DDBaseImplement`](#ddbaseimplement).[`triggerEvent`](#triggerevent)\n\n##### updateOption()\n\n```ts\nupdateOption(opts): DDResizable;\n```\n\nDefined in: [dd-resizable.ts:96](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L96)\n\nMethod to update the options and return the DD implementation\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `opts` | [`DDResizableOpt`](#ddresizableopt) |\n\n###### Returns\n\n[`DDResizable`](#ddresizable-1)\n\n###### Implementation of\n\n[`HTMLElementExtendOpt`](#htmlelementextendopt).[`updateOption`](#updateoption-6)\n\n#### Properties\n\n| Property | Modifier | Type | Default value | Description | Defined in |\n| ------ | ------ | ------ | ------ | ------ | ------ |\n| <a id=\"el-3\"></a> `el` | `public` | [`GridItemHTMLElement`](#griditemhtmlelement) | `undefined` | The HTML element being extended | [dd-resizable.ts:59](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L59) |\n| <a id=\"option-2\"></a> `option` | `public` | [`DDResizableOpt`](#ddresizableopt) | `{}` | The drag & drop options/configuration | [dd-resizable.ts:59](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L59) |\n\n***\n\n<a id=\"ddresizablehandle\"></a>\n### DDResizableHandle\n\nDefined in: [dd-resizable-handle.ts:16](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable-handle.ts#L16)\n\n#### Constructors\n\n##### Constructor\n\n```ts\nnew DDResizableHandle(\n   host, \n   dir, \n   option): DDResizableHandle;\n```\n\nDefined in: [dd-resizable-handle.ts:26](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable-handle.ts#L26)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `host` | [`GridItemHTMLElement`](#griditemhtmlelement) |\n| `dir` | `string` |\n| `option` | [`DDResizableHandleOpt`](#ddresizablehandleopt) |\n\n###### Returns\n\n[`DDResizableHandle`](#ddresizablehandle)\n\n#### Methods\n\n##### destroy()\n\n```ts\ndestroy(): DDResizableHandle;\n```\n\nDefined in: [dd-resizable-handle.ts:70](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable-handle.ts#L70)\n\ncall this when resize handle needs to be removed and cleaned up\n\n###### Returns\n\n[`DDResizableHandle`](#ddresizablehandle)\n\n#### Properties\n\n| Property | Modifier | Type | Defined in |\n| ------ | ------ | ------ | ------ |\n| <a id=\"dir\"></a> `dir` | `protected` | `string` | [dd-resizable-handle.ts:26](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable-handle.ts#L26) |\n| <a id=\"host\"></a> `host` | `protected` | [`GridItemHTMLElement`](#griditemhtmlelement) | [dd-resizable-handle.ts:26](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable-handle.ts#L26) |\n| <a id=\"option-3\"></a> `option` | `protected` | [`DDResizableHandleOpt`](#ddresizablehandleopt) | [dd-resizable-handle.ts:26](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable-handle.ts#L26) |\n\n***\n\n<a id=\"breakpoint\"></a>\n### Breakpoint\n\nDefined in: [types.ts:170](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L170)\n\nDefines a responsive breakpoint for automatic column count changes.\r\nUsed with the responsive.breakpoints option.\n\n#### Properties\n\n| Property | Type | Description | Defined in |\n| ------ | ------ | ------ | ------ |\n| <a id=\"c\"></a> `c` | `number` | Number of columns to use when this breakpoint is active | [types.ts:174](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L174) |\n| <a id=\"layout\"></a> `layout?` | [`ColumnOptions`](#columnoptions) | Layout mode for this specific breakpoint (overrides global responsive.layout) | [types.ts:176](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L176) |\n| <a id=\"w\"></a> `w?` | `number` | Maximum width (in pixels) for this breakpoint to be active | [types.ts:172](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L172) |\n\n***\n\n<a id=\"cellposition\"></a>\n### CellPosition\n\nDefined in: [gridstack.ts:56](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L56)\n\nDefines the position of a cell inside the grid\n\n#### Properties\n\n| Property | Type | Defined in |\n| ------ | ------ | ------ |\n| <a id=\"x\"></a> `x` | `number` | [gridstack.ts:57](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L57) |\n| <a id=\"y\"></a> `y` | `number` | [gridstack.ts:58](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L58) |\n\n***\n\n<a id=\"dddragopt\"></a>\n### DDDragOpt\n\nDefined in: [types.ts:483](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L483)\n\nDrag&Drop dragging options\n\n#### Properties\n\n| Property | Type | Description | Defined in |\n| ------ | ------ | ------ | ------ |\n| <a id=\"appendto\"></a> `appendTo?` | `string` | default to 'body' | [types.ts:487](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L487) |\n| <a id=\"cancel\"></a> `cancel?` | `string` | prevents dragging from starting on specified elements, listed as comma separated selectors (eg: '.no-drag'). default built in is 'input,textarea,button,select,option' | [types.ts:493](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L493) |\n| <a id=\"drag\"></a> `drag?` | (`event`, `ui`) => `void` | - | [types.ts:499](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L499) |\n| <a id=\"handle\"></a> `handle?` | `string` | class selector of items that can be dragged. default to '.grid-stack-item-content' | [types.ts:485](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L485) |\n| <a id=\"helper-1\"></a> `helper?` | `\"clone\"` \\| (`el`) => `HTMLElement` | helper function when dropping: 'clone' or your own method | [types.ts:495](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L495) |\n| <a id=\"pause\"></a> `pause?` | `number` \\| `boolean` | if set (true | msec), dragging placement (collision) will only happen after a pause by the user. Note: this is Global | [types.ts:489](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L489) |\n| <a id=\"scroll\"></a> `scroll?` | `boolean` | default to `true` | [types.ts:491](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L491) |\n| <a id=\"start\"></a> `start?` | (`event`, `ui`) => `void` | callbacks | [types.ts:497](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L497) |\n| <a id=\"stop\"></a> `stop?` | (`event`) => `void` | - | [types.ts:498](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L498) |\n\n***\n\n<a id=\"dddroppableopt\"></a>\n### DDDroppableOpt\n\nDefined in: [dd-droppable.ts:14](https://github.com/adumesny/gridstack.js/blob/master/src/dd-droppable.ts#L14)\n\n#### Properties\n\n| Property | Type | Defined in |\n| ------ | ------ | ------ |\n| <a id=\"accept-2\"></a> `accept?` | `string` \\| (`el`) => `boolean` | [dd-droppable.ts:15](https://github.com/adumesny/gridstack.js/blob/master/src/dd-droppable.ts#L15) |\n| <a id=\"drop-2\"></a> `drop?` | (`event`, `ui`) => `void` | [dd-droppable.ts:16](https://github.com/adumesny/gridstack.js/blob/master/src/dd-droppable.ts#L16) |\n| <a id=\"out\"></a> `out?` | (`event`, `ui`) => `void` | [dd-droppable.ts:18](https://github.com/adumesny/gridstack.js/blob/master/src/dd-droppable.ts#L18) |\n| <a id=\"over\"></a> `over?` | (`event`, `ui`) => `void` | [dd-droppable.ts:17](https://github.com/adumesny/gridstack.js/blob/master/src/dd-droppable.ts#L17) |\n\n***\n\n<a id=\"ddelementhost\"></a>\n### DDElementHost\n\nDefined in: [dd-element.ts:11](https://github.com/adumesny/gridstack.js/blob/master/src/dd-element.ts#L11)\n\nExtended HTMLElement interface for grid items.\r\nAll grid item DOM elements implement this interface to provide access to their grid data.\n\n#### Extends\n\n- [`GridItemHTMLElement`](#griditemhtmlelement)\n\n#### Properties\n\n| Property | Type | Description | Inherited from | Defined in |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"ddelement-1\"></a> `ddElement?` | [`DDElement`](#ddelement) | - | - | [dd-element.ts:12](https://github.com/adumesny/gridstack.js/blob/master/src/dd-element.ts#L12) |\n| <a id=\"gridstacknode\"></a> `gridstackNode?` | [`GridStackNode`](#gridstacknode-2) | Pointer to the associated grid node instance containing position, size, and other widget data | [`GridItemHTMLElement`](#griditemhtmlelement).[`gridstackNode`](#gridstacknode-1) | [types.ts:78](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L78) |\n\n***\n\n<a id=\"ddremoveopt\"></a>\n### DDRemoveOpt\n\nDefined in: [types.ts:475](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L475)\n\nDrag&Drop remove options\n\n#### Properties\n\n| Property | Type | Description | Defined in |\n| ------ | ------ | ------ | ------ |\n| <a id=\"accept-3\"></a> `accept?` | `string` | class that can be removed (default?: opts.itemClass) | [types.ts:477](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L477) |\n| <a id=\"decline\"></a> `decline?` | `string` | class that cannot be removed (default: 'grid-stack-non-removable') | [types.ts:479](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L479) |\n\n***\n\n<a id=\"ddresizablehandleopt\"></a>\n### DDResizableHandleOpt\n\nDefined in: [dd-resizable-handle.ts:9](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable-handle.ts#L9)\n\n#### Properties\n\n| Property | Type | Defined in |\n| ------ | ------ | ------ |\n| <a id=\"element\"></a> `element?` | `string` \\| `HTMLElement` | [dd-resizable-handle.ts:10](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable-handle.ts#L10) |\n| <a id=\"move\"></a> `move?` | (`event`) => `void` | [dd-resizable-handle.ts:12](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable-handle.ts#L12) |\n| <a id=\"start-1\"></a> `start?` | (`event`) => `void` | [dd-resizable-handle.ts:11](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable-handle.ts#L11) |\n| <a id=\"stop-1\"></a> `stop?` | (`event`) => `void` | [dd-resizable-handle.ts:13](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable-handle.ts#L13) |\n\n***\n\n<a id=\"ddresizableopt\"></a>\n### DDResizableOpt\n\nDefined in: [dd-resizable.ts:15](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L15)\n\nDrag&Drop resize options\n\n#### Extends\n\n- [`DDResizeOpt`](#ddresizeopt)\n\n#### Properties\n\n| Property | Type | Description | Inherited from | Defined in |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"autohide\"></a> `autoHide?` | `boolean` | do resize handle hide by default until mouse over. default: true on desktop, false on mobile | [`DDResizeOpt`](#ddresizeopt).[`autoHide`](#autohide-1) | [types.ts:461](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L461) |\n| <a id=\"element-1\"></a> `element?` | `string` \\| `HTMLElement` | Custom element or query inside the widget node that is used instead of the generated resize handle. | [`DDResizeOpt`](#ddresizeopt).[`element`](#element-2) | [types.ts:471](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L471) |\n| <a id=\"handles\"></a> `handles?` | `string` | sides where you can resize from (ex: 'e, se, s, sw, w') - default 'se' (south-east) Note: it is not recommended to resize from the top sides as weird side effect may occur. | [`DDResizeOpt`](#ddresizeopt).[`handles`](#handles-1) | [types.ts:466](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L466) |\n| <a id=\"maxheight\"></a> `maxHeight?` | `number` | - | - | [dd-resizable.ts:16](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L16) |\n| <a id=\"maxheightmoveup\"></a> `maxHeightMoveUp?` | `number` | - | - | [dd-resizable.ts:17](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L17) |\n| <a id=\"maxwidth\"></a> `maxWidth?` | `number` | - | - | [dd-resizable.ts:18](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L18) |\n| <a id=\"maxwidthmoveleft\"></a> `maxWidthMoveLeft?` | `number` | - | - | [dd-resizable.ts:19](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L19) |\n| <a id=\"minheight\"></a> `minHeight?` | `number` | - | - | [dd-resizable.ts:20](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L20) |\n| <a id=\"minwidth\"></a> `minWidth?` | `number` | - | - | [dd-resizable.ts:21](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L21) |\n| <a id=\"resize\"></a> `resize?` | (`event`, `ui`) => `void` | - | - | [dd-resizable.ts:24](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L24) |\n| <a id=\"start-2\"></a> `start?` | (`event`, `ui`) => `void` | - | - | [dd-resizable.ts:22](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L22) |\n| <a id=\"stop-2\"></a> `stop?` | (`event`) => `void` | - | - | [dd-resizable.ts:23](https://github.com/adumesny/gridstack.js/blob/master/src/dd-resizable.ts#L23) |\n\n***\n\n<a id=\"ddresizeopt\"></a>\n### DDResizeOpt\n\nDefined in: [types.ts:459](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L459)\n\nDrag&Drop resize options\n\n#### Extended by\n\n- [`DDResizableOpt`](#ddresizableopt)\n\n#### Properties\n\n| Property | Type | Description | Defined in |\n| ------ | ------ | ------ | ------ |\n| <a id=\"autohide-1\"></a> `autoHide?` | `boolean` | do resize handle hide by default until mouse over. default: true on desktop, false on mobile | [types.ts:461](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L461) |\n| <a id=\"element-2\"></a> `element?` | `string` \\| `HTMLElement` | Custom element or query inside the widget node that is used instead of the generated resize handle. | [types.ts:471](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L471) |\n| <a id=\"handles-1\"></a> `handles?` | `string` | sides where you can resize from (ex: 'e, se, s, sw, w') - default 'se' (south-east) Note: it is not recommended to resize from the top sides as weird side effect may occur. | [types.ts:466](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L466) |\n\n***\n\n<a id=\"dduidata\"></a>\n### DDUIData\n\nDefined in: [types.ts:512](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L512)\n\ndata that is passed during drag and resizing callbacks\n\n#### Properties\n\n| Property | Type | Defined in |\n| ------ | ------ | ------ |\n| <a id=\"draggable-2\"></a> `draggable?` | `HTMLElement` | [types.ts:515](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L515) |\n| <a id=\"position\"></a> `position?` | [`Position`](#position-1) | [types.ts:513](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L513) |\n| <a id=\"size\"></a> `size?` | [`Size`](#size-1) | [types.ts:514](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L514) |\n\n***\n\n<a id=\"dragtransform\"></a>\n### DragTransform\n\nDefined in: [utils.ts:13](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L13)\n\n#### Properties\n\n| Property | Type | Defined in |\n| ------ | ------ | ------ |\n| <a id=\"xoffset\"></a> `xOffset` | `number` | [utils.ts:16](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L16) |\n| <a id=\"xscale\"></a> `xScale` | `number` | [utils.ts:14](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L14) |\n| <a id=\"yoffset\"></a> `yOffset` | `number` | [utils.ts:17](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L17) |\n| <a id=\"yscale\"></a> `yScale` | `number` | [utils.ts:15](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L15) |\n\n***\n\n<a id=\"gridhtmlelement\"></a>\n### GridHTMLElement\n\nDefined in: [gridstack.ts:42](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L42)\n\n#### Extends\n\n- `HTMLElement`\n\n#### Properties\n\n| Property | Type | Defined in |\n| ------ | ------ | ------ |\n| <a id=\"gridstack\"></a> `gridstack?` | [`GridStack`](#gridstack-1) | [gridstack.ts:43](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L43) |\n\n***\n\n<a id=\"griditemhtmlelement\"></a>\n### GridItemHTMLElement\n\nDefined in: [types.ts:76](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L76)\n\nExtended HTMLElement interface for grid items.\r\nAll grid item DOM elements implement this interface to provide access to their grid data.\n\n#### Extends\n\n- `HTMLElement`\n\n#### Extended by\n\n- [`DDElementHost`](#ddelementhost)\n\n#### Properties\n\n| Property | Type | Description | Defined in |\n| ------ | ------ | ------ | ------ |\n| <a id=\"gridstacknode-1\"></a> `gridstackNode?` | [`GridStackNode`](#gridstacknode-2) | Pointer to the associated grid node instance containing position, size, and other widget data | [types.ts:78](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L78) |\n\n***\n\n<a id=\"gridstackengineoptions\"></a>\n### GridStackEngineOptions\n\nDefined in: [gridstack-engine.ts:13](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L13)\n\noptions used during creation - similar to GridStackOptions\n\n#### Properties\n\n| Property | Type | Defined in |\n| ------ | ------ | ------ |\n| <a id=\"column-3\"></a> `column?` | `number` | [gridstack-engine.ts:14](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L14) |\n| <a id=\"float-3\"></a> `float?` | `boolean` | [gridstack-engine.ts:16](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L16) |\n| <a id=\"maxrow-1\"></a> `maxRow?` | `number` | [gridstack-engine.ts:15](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L15) |\n| <a id=\"nodes-1\"></a> `nodes?` | [`GridStackNode`](#gridstacknode-2)[] | [gridstack-engine.ts:17](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L17) |\n| <a id=\"onchange\"></a> `onChange?` | `OnChangeCB` | [gridstack-engine.ts:18](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack-engine.ts#L18) |\n\n***\n\n<a id=\"gridstackmoveopts\"></a>\n### GridStackMoveOpts\n\nDefined in: [types.ts:388](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L388)\n\noptions used during GridStackEngine.moveNode()\n\n#### Extends\n\n- [`GridStackPosition`](#gridstackposition)\n\n#### Properties\n\n| Property | Type | Description | Inherited from | Defined in |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"cellheight-2\"></a> `cellHeight?` | `number` | - | - | [types.ts:397](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L397) |\n| <a id=\"cellwidth-2\"></a> `cellWidth?` | `number` | vars to calculate other cells coordinates | - | [types.ts:396](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L396) |\n| <a id=\"collide-2\"></a> `collide?` | [`GridStackNode`](#gridstacknode-2) | best node (most coverage) we collied with | - | [types.ts:407](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L407) |\n| <a id=\"forcecollide\"></a> `forceCollide?` | `boolean` | for collision check even if we don't move | - | [types.ts:409](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L409) |\n| <a id=\"h\"></a> `h?` | `number` | widget dimension height (default?: 1) | [`GridStackPosition`](#gridstackposition).[`h`](#h-2) | [types.ts:420](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L420) |\n| <a id=\"marginbottom\"></a> `marginBottom?` | `number` | - | - | [types.ts:399](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L399) |\n| <a id=\"marginleft\"></a> `marginLeft?` | `number` | - | - | [types.ts:400](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L400) |\n| <a id=\"marginright\"></a> `marginRight?` | `number` | - | - | [types.ts:401](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L401) |\n| <a id=\"margintop\"></a> `marginTop?` | `number` | - | - | [types.ts:398](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L398) |\n| <a id=\"nested\"></a> `nested?` | `boolean` | true if we are calling this recursively to prevent simple swap or coverage collision - default false | - | [types.ts:394](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L394) |\n| <a id=\"pack\"></a> `pack?` | `boolean` | do we pack (default true) | - | [types.ts:392](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L392) |\n| <a id=\"rect\"></a> `rect?` | [`GridStackPosition`](#gridstackposition) | position in pixels of the currently dragged items (for overlap check) | - | [types.ts:403](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L403) |\n| <a id=\"resizing\"></a> `resizing?` | `boolean` | true if we're live resizing | - | [types.ts:405](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L405) |\n| <a id=\"skip\"></a> `skip?` | [`GridStackNode`](#gridstacknode-2) | node to skip collision | - | [types.ts:390](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L390) |\n| <a id=\"w-1\"></a> `w?` | `number` | widget dimension width (default?: 1) | [`GridStackPosition`](#gridstackposition).[`w`](#w-3) | [types.ts:418](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L418) |\n| <a id=\"x-1\"></a> `x?` | `number` | widget position x (default?: 0) | [`GridStackPosition`](#gridstackposition).[`x`](#x-3) | [types.ts:414](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L414) |\n| <a id=\"y-1\"></a> `y?` | `number` | widget position y (default?: 0) | [`GridStackPosition`](#gridstackposition).[`y`](#y-3) | [types.ts:416](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L416) |\n\n***\n\n<a id=\"gridstacknode-2\"></a>\n### GridStackNode\n\nDefined in: [types.ts:529](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L529)\n\ninternal runtime descriptions describing the widgets in the grid\n\n#### Extends\n\n- [`GridStackWidget`](#gridstackwidget)\n\n#### Properties\n\n| Property | Type | Description | Inherited from | Defined in |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"autoposition\"></a> `autoPosition?` | `boolean` | if true then x, y parameters will be ignored and widget will be places on the first available position (default?: false) | [`GridStackWidget`](#gridstackwidget).[`autoPosition`](#autoposition-1) | [types.ts:428](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L428) |\n| <a id=\"content\"></a> `content?` | `string` | html to append inside as content | [`GridStackWidget`](#gridstackwidget).[`content`](#content-1) | [types.ts:446](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L446) |\n| <a id=\"el-5\"></a> `el?` | [`GridItemHTMLElement`](#griditemhtmlelement) | pointer back to HTML element | - | [types.ts:531](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L531) |\n| <a id=\"grid\"></a> `grid?` | [`GridStack`](#gridstack-1) | pointer back to parent Grid instance | - | [types.ts:533](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L533) |\n| <a id=\"h-1\"></a> `h?` | `number` | widget dimension height (default?: 1) | [`GridStackWidget`](#gridstackwidget).[`h`](#h-3) | [types.ts:420](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L420) |\n| <a id=\"id\"></a> `id?` | `string` | value for `gs-id` stored on the widget (default?: undefined) | [`GridStackWidget`](#gridstackwidget).[`id`](#id-1) | [types.ts:444](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L444) |\n| <a id=\"lazyload\"></a> `lazyLoad?` | `boolean` | true when widgets are only created when they scroll into view (visible) | [`GridStackWidget`](#gridstackwidget).[`lazyLoad`](#lazyload-2) | [types.ts:448](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L448) |\n| <a id=\"locked\"></a> `locked?` | `boolean` | prevents being pushed by other widgets or api (default?: undefined = un-constrained), which is different from `noMove` (user action only) | [`GridStackWidget`](#gridstackwidget).[`locked`](#locked-1) | [types.ts:442](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L442) |\n| <a id=\"maxh\"></a> `maxH?` | `number` | maximum height allowed during resize/creation (default?: undefined = un-constrained) | [`GridStackWidget`](#gridstackwidget).[`maxH`](#maxh-1) | [types.ts:436](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L436) |\n| <a id=\"maxw\"></a> `maxW?` | `number` | maximum width allowed during resize/creation (default?: undefined = un-constrained) | [`GridStackWidget`](#gridstackwidget).[`maxW`](#maxw-1) | [types.ts:432](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L432) |\n| <a id=\"minh\"></a> `minH?` | `number` | minimum height allowed during resize/creation (default?: undefined = un-constrained) | [`GridStackWidget`](#gridstackwidget).[`minH`](#minh-1) | [types.ts:434](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L434) |\n| <a id=\"minw\"></a> `minW?` | `number` | minimum width allowed during resize/creation (default?: undefined = un-constrained) | [`GridStackWidget`](#gridstackwidget).[`minW`](#minw-1) | [types.ts:430](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L430) |\n| <a id=\"nomove\"></a> `noMove?` | `boolean` | prevents direct moving by the user (default?: undefined = un-constrained) | [`GridStackWidget`](#gridstackwidget).[`noMove`](#nomove-1) | [types.ts:440](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L440) |\n| <a id=\"noresize\"></a> `noResize?` | `boolean` | prevent direct resizing by the user (default?: undefined = un-constrained) | [`GridStackWidget`](#gridstackwidget).[`noResize`](#noresize-1) | [types.ts:438](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L438) |\n| <a id=\"resizetocontentparent-1\"></a> `resizeToContentParent?` | `string` | local override of GridStack.resizeToContentParent that specify the class to use for the parent (actual) vs child (wanted) height | [`GridStackWidget`](#gridstackwidget).[`resizeToContentParent`](#resizetocontentparent-2) | [types.ts:453](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L453) |\n| <a id=\"sizetocontent\"></a> `sizeToContent?` | `number` \\| `boolean` | local (vs grid) override - see GridStackOptions. Note: This also allow you to set a maximum h value (but user changeable during normal resizing) to prevent unlimited content from taking too much space (get scrollbar) | [`GridStackWidget`](#gridstackwidget).[`sizeToContent`](#sizetocontent-2) | [types.ts:451](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L451) |\n| <a id=\"subgrid\"></a> `subGrid?` | [`GridStack`](#gridstack-1) | actual sub-grid instance | - | [types.ts:535](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L535) |\n| <a id=\"subgridopts\"></a> `subGridOpts?` | [`GridStackOptions`](#gridstackoptions) | optional nested grid options and list of children, which then turns into actual instance at runtime to get options from | [`GridStackWidget`](#gridstackwidget).[`subGridOpts`](#subgridopts-2) | [types.ts:455](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L455) |\n| <a id=\"visibleobservable\"></a> `visibleObservable?` | `IntersectionObserver` | allow delay creation when visible | - | [types.ts:537](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L537) |\n| <a id=\"w-2\"></a> `w?` | `number` | widget dimension width (default?: 1) | [`GridStackWidget`](#gridstackwidget).[`w`](#w-4) | [types.ts:418](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L418) |\n| <a id=\"x-2\"></a> `x?` | `number` | widget position x (default?: 0) | [`GridStackWidget`](#gridstackwidget).[`x`](#x-4) | [types.ts:414](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L414) |\n| <a id=\"y-2\"></a> `y?` | `number` | widget position y (default?: 0) | [`GridStackWidget`](#gridstackwidget).[`y`](#y-4) | [types.ts:416](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L416) |\n\n***\n\n<a id=\"gridstackposition\"></a>\n### GridStackPosition\n\nDefined in: [types.ts:412](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L412)\n\n#### Extended by\n\n- [`GridStackMoveOpts`](#gridstackmoveopts)\n- [`GridStackWidget`](#gridstackwidget)\n\n#### Properties\n\n| Property | Type | Description | Defined in |\n| ------ | ------ | ------ | ------ |\n| <a id=\"h-2\"></a> `h?` | `number` | widget dimension height (default?: 1) | [types.ts:420](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L420) |\n| <a id=\"w-3\"></a> `w?` | `number` | widget dimension width (default?: 1) | [types.ts:418](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L418) |\n| <a id=\"x-3\"></a> `x?` | `number` | widget position x (default?: 0) | [types.ts:414](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L414) |\n| <a id=\"y-3\"></a> `y?` | `number` | widget position y (default?: 0) | [types.ts:416](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L416) |\n\n***\n\n<a id=\"gridstackwidget\"></a>\n### GridStackWidget\n\nDefined in: [types.ts:426](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L426)\n\nGridStack Widget creation options\n\n#### Extends\n\n- [`GridStackPosition`](#gridstackposition)\n\n#### Extended by\n\n- [`GridStackNode`](#gridstacknode-2)\n\n#### Properties\n\n| Property | Type | Description | Inherited from | Defined in |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"autoposition-1\"></a> `autoPosition?` | `boolean` | if true then x, y parameters will be ignored and widget will be places on the first available position (default?: false) | - | [types.ts:428](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L428) |\n| <a id=\"content-1\"></a> `content?` | `string` | html to append inside as content | - | [types.ts:446](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L446) |\n| <a id=\"h-3\"></a> `h?` | `number` | widget dimension height (default?: 1) | [`GridStackPosition`](#gridstackposition).[`h`](#h-2) | [types.ts:420](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L420) |\n| <a id=\"id-1\"></a> `id?` | `string` | value for `gs-id` stored on the widget (default?: undefined) | - | [types.ts:444](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L444) |\n| <a id=\"lazyload-2\"></a> `lazyLoad?` | `boolean` | true when widgets are only created when they scroll into view (visible) | - | [types.ts:448](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L448) |\n| <a id=\"locked-1\"></a> `locked?` | `boolean` | prevents being pushed by other widgets or api (default?: undefined = un-constrained), which is different from `noMove` (user action only) | - | [types.ts:442](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L442) |\n| <a id=\"maxh-1\"></a> `maxH?` | `number` | maximum height allowed during resize/creation (default?: undefined = un-constrained) | - | [types.ts:436](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L436) |\n| <a id=\"maxw-1\"></a> `maxW?` | `number` | maximum width allowed during resize/creation (default?: undefined = un-constrained) | - | [types.ts:432](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L432) |\n| <a id=\"minh-1\"></a> `minH?` | `number` | minimum height allowed during resize/creation (default?: undefined = un-constrained) | - | [types.ts:434](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L434) |\n| <a id=\"minw-1\"></a> `minW?` | `number` | minimum width allowed during resize/creation (default?: undefined = un-constrained) | - | [types.ts:430](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L430) |\n| <a id=\"nomove-1\"></a> `noMove?` | `boolean` | prevents direct moving by the user (default?: undefined = un-constrained) | - | [types.ts:440](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L440) |\n| <a id=\"noresize-1\"></a> `noResize?` | `boolean` | prevent direct resizing by the user (default?: undefined = un-constrained) | - | [types.ts:438](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L438) |\n| <a id=\"resizetocontentparent-2\"></a> `resizeToContentParent?` | `string` | local override of GridStack.resizeToContentParent that specify the class to use for the parent (actual) vs child (wanted) height | - | [types.ts:453](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L453) |\n| <a id=\"sizetocontent-2\"></a> `sizeToContent?` | `number` \\| `boolean` | local (vs grid) override - see GridStackOptions. Note: This also allow you to set a maximum h value (but user changeable during normal resizing) to prevent unlimited content from taking too much space (get scrollbar) | - | [types.ts:451](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L451) |\n| <a id=\"subgridopts-2\"></a> `subGridOpts?` | [`GridStackOptions`](#gridstackoptions) | optional nested grid options and list of children, which then turns into actual instance at runtime to get options from | - | [types.ts:455](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L455) |\n| <a id=\"w-4\"></a> `w?` | `number` | widget dimension width (default?: 1) | [`GridStackPosition`](#gridstackposition).[`w`](#w-3) | [types.ts:418](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L418) |\n| <a id=\"x-4\"></a> `x?` | `number` | widget position x (default?: 0) | [`GridStackPosition`](#gridstackposition).[`x`](#x-3) | [types.ts:414](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L414) |\n| <a id=\"y-4\"></a> `y?` | `number` | widget position y (default?: 0) | [`GridStackPosition`](#gridstackposition).[`y`](#y-3) | [types.ts:416](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L416) |\n\n***\n\n<a id=\"heightdata\"></a>\n### HeightData\n\nDefined in: [utils.ts:8](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L8)\n\n#### Properties\n\n| Property | Type | Defined in |\n| ------ | ------ | ------ |\n| <a id=\"h-4\"></a> `h` | `number` | [utils.ts:9](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L9) |\n| <a id=\"unit\"></a> `unit` | `string` | [utils.ts:10](https://github.com/adumesny/gridstack.js/blob/master/src/utils.ts#L10) |\n\n***\n\n<a id=\"htmlelementextendoptt\"></a>\n### HTMLElementExtendOpt\\<T\\>\n\nDefined in: [dd-base-impl.ts:91](https://github.com/adumesny/gridstack.js/blob/master/src/dd-base-impl.ts#L91)\n\nInterface for HTML elements extended with drag & drop options.\nUsed to associate DD configuration with DOM elements.\n\n#### Type Parameters\n\n| Type Parameter |\n| ------ |\n| `T` |\n\n#### Methods\n\n##### updateOption()\n\n```ts\nupdateOption(T): DDBaseImplement;\n```\n\nDefined in: [dd-base-impl.ts:97](https://github.com/adumesny/gridstack.js/blob/master/src/dd-base-impl.ts#L97)\n\nMethod to update the options and return the DD implementation\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `T` | `any` |\n\n###### Returns\n\n[`DDBaseImplement`](#ddbaseimplement)\n\n#### Properties\n\n| Property | Type | Description | Defined in |\n| ------ | ------ | ------ | ------ |\n| <a id=\"el-6\"></a> `el` | `HTMLElement` | The HTML element being extended | [dd-base-impl.ts:93](https://github.com/adumesny/gridstack.js/blob/master/src/dd-base-impl.ts#L93) |\n| <a id=\"option-4\"></a> `option` | `T` | The drag & drop options/configuration | [dd-base-impl.ts:95](https://github.com/adumesny/gridstack.js/blob/master/src/dd-base-impl.ts#L95) |\n\n***\n\n<a id=\"mouseposition\"></a>\n### MousePosition\n\nDefined in: [gridstack.ts:50](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L50)\n\nDefines the coordinates of an object\n\n#### Properties\n\n| Property | Type | Defined in |\n| ------ | ------ | ------ |\n| <a id=\"left\"></a> `left` | `number` | [gridstack.ts:52](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L52) |\n| <a id=\"top\"></a> `top` | `number` | [gridstack.ts:51](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L51) |\n\n***\n\n<a id=\"position-1\"></a>\n### Position\n\nDefined in: [types.ts:505](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L505)\n\n#### Extended by\n\n- [`Rect`](#rect-1)\n\n#### Properties\n\n| Property | Type | Defined in |\n| ------ | ------ | ------ |\n| <a id=\"left-1\"></a> `left` | `number` | [types.ts:507](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L507) |\n| <a id=\"top-1\"></a> `top` | `number` | [types.ts:506](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L506) |\n\n***\n\n<a id=\"rect-1\"></a>\n### Rect\n\nDefined in: [types.ts:509](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L509)\n\n#### Extends\n\n- [`Size`](#size-1).[`Position`](#position-1)\n\n#### Properties\n\n| Property | Type | Inherited from | Defined in |\n| ------ | ------ | ------ | ------ |\n| <a id=\"height\"></a> `height` | `number` | [`Size`](#size-1).[`height`](#height-1) | [types.ts:503](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L503) |\n| <a id=\"left-2\"></a> `left` | `number` | [`Position`](#position-1).[`left`](#left-1) | [types.ts:507](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L507) |\n| <a id=\"top-2\"></a> `top` | `number` | [`Position`](#position-1).[`top`](#top-1) | [types.ts:506](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L506) |\n| <a id=\"width\"></a> `width` | `number` | [`Size`](#size-1).[`width`](#width-1) | [types.ts:502](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L502) |\n\n***\n\n<a id=\"responsive\"></a>\n### Responsive\n\nDefined in: [types.ts:153](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L153)\n\nConfiguration for responsive grid behavior.\n\nDefines how the grid responds to different screen sizes by changing column counts.\r\nNOTE: Make sure to include the appropriate CSS (gridstack-extra.css) to support responsive behavior.\n\n#### Properties\n\n| Property | Type | Description | Defined in |\n| ------ | ------ | ------ | ------ |\n| <a id=\"breakpointforwindow\"></a> `breakpointForWindow?` | `boolean` | specify if breakpoints are for window size or grid size (default:false = grid) | [types.ts:161](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L161) |\n| <a id=\"breakpoints\"></a> `breakpoints?` | [`Breakpoint`](#breakpoint)[] | explicit width:column breakpoints instead of automatic 'columnWidth'. NOTE: make sure to have correct extra CSS to support this. | [types.ts:159](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L159) |\n| <a id=\"columnmax\"></a> `columnMax?` | `number` | maximum number of columns allowed (default: 12). NOTE: make sure to have correct extra CSS to support this. | [types.ts:157](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L157) |\n| <a id=\"columnwidth\"></a> `columnWidth?` | `number` | wanted width to maintain (+-50%) to dynamically pick a column count. NOTE: make sure to have correct extra CSS to support this. | [types.ts:155](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L155) |\n| <a id=\"layout-2\"></a> `layout?` | [`ColumnOptions`](#columnoptions) | global re-layout mode when changing columns | [types.ts:163](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L163) |\n\n***\n\n<a id=\"size-1\"></a>\n### Size\n\nDefined in: [types.ts:501](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L501)\n\n#### Extended by\n\n- [`Rect`](#rect-1)\n\n#### Properties\n\n| Property | Type | Defined in |\n| ------ | ------ | ------ |\n| <a id=\"height-1\"></a> `height` | `number` | [types.ts:503](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L503) |\n| <a id=\"width-1\"></a> `width` | `number` | [types.ts:502](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L502) |\n\n## Variables\n\n<a id=\"griddefaults\"></a>\n### gridDefaults\n\n```ts\nconst gridDefaults: GridStackOptions;\n```\n\nDefined in: [types.ts:13](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L13)\n\nDefault values for grid options - used during initialization and when saving out grid configuration.\r\nThese values are applied when options are not explicitly provided.\n\n## Type Aliases\n\n<a id=\"addremovefcn\"></a>\n### AddRemoveFcn()\n\n```ts\ntype AddRemoveFcn = (parent, w, add, grid) => HTMLElement | undefined;\n```\n\nDefined in: [types.ts:119](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L119)\n\nOptional callback function called during load() operations.\r\nAllows custom handling of widget addition/removal for framework integration.\n\n#### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `parent` | `HTMLElement` | The parent HTML element |\n| `w` | [`GridStackWidget`](#gridstackwidget) | The widget definition |\n| `add` | `boolean` | True if adding, false if removing |\n| `grid` | `boolean` | True if this is a grid operation |\n\n#### Returns\n\n`HTMLElement` \\| `undefined`\n\nThe created/modified HTML element, or undefined\n\n***\n\n<a id=\"columnoptions\"></a>\n### ColumnOptions\n\n```ts\ntype ColumnOptions = \n  | \"list\"\n  | \"compact\"\n  | \"moveScale\"\n  | \"move\"\n  | \"scale\"\n  | \"none\"\n  | (column, oldColumn, nodes, oldNodes) => void;\n```\n\nDefined in: [types.ts:59](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L59)\n\nDifferent layout options when changing the number of columns.\n\nThese options control how widgets are repositioned when the grid column count changes.\r\nNote: The new list may be partially filled if there's a cached layout for that size.\n\nOptions:\r\n- `'list'`: Treat items as a sorted list, keeping them sequentially without resizing (unless too big)\r\n- `'compact'`: Similar to list, but uses compact() method to fill empty slots by reordering\r\n- `'moveScale'`: Scale and move items by the ratio of newColumnCount / oldColumnCount\r\n- `'move'`: Only move items, keep their sizes\r\n- `'scale'`: Only scale items, keep their positions\r\n- `'none'`: Leave items unchanged unless they don't fit in the new column count\r\n- Custom function: Provide your own layout logic\n\n***\n\n<a id=\"compactoptions\"></a>\n### CompactOptions\n\n```ts\ntype CompactOptions = \"list\" | \"compact\";\n```\n\nDefined in: [types.ts:66](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L66)\n\nOptions for the compact() method to reclaim empty space.\r\n- `'list'`: Keep items in order, move them up sequentially\r\n- `'compact'`: Find truly empty spaces, may reorder items for optimal fit\n\n***\n\n<a id=\"ddcallback\"></a>\n### DDCallback()\n\n```ts\ntype DDCallback = (event, arg2, helper?) => void;\n```\n\nDefined in: [dd-gridstack.ts:46](https://github.com/adumesny/gridstack.js/blob/master/src/dd-gridstack.ts#L46)\n\nCallback function type for drag & drop events.\n\n#### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `event` | `Event` | The DOM event that triggered the callback |\n| `arg2` | [`GridItemHTMLElement`](#griditemhtmlelement) | The grid item element being dragged/dropped |\n| `helper?` | [`GridItemHTMLElement`](#griditemhtmlelement) | Optional helper element used during drag operations |\n\n#### Returns\n\n`void`\n\n***\n\n<a id=\"dddropopt\"></a>\n### DDDropOpt\n\n```ts\ntype DDDropOpt = object;\n```\n\nDefined in: [dd-gridstack.ts:17](https://github.com/adumesny/gridstack.js/blob/master/src/dd-gridstack.ts#L17)\n\nDrag & Drop options for drop targets.\r\nConfigures which elements can be dropped onto a grid.\n\n#### Properties\n\n##### accept()?\n\n```ts\noptional accept: (el) => boolean;\n```\n\nDefined in: [dd-gridstack.ts:19](https://github.com/adumesny/gridstack.js/blob/master/src/dd-gridstack.ts#L19)\n\nFunction to determine if an element can be dropped (see GridStackOptions.acceptWidgets)\n\n###### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `el` | [`GridItemHTMLElement`](#griditemhtmlelement) |\n\n###### Returns\n\n`boolean`\n\n***\n\n<a id=\"ddkey\"></a>\n### DDKey\n\n```ts\ntype DDKey = \n  | \"minWidth\"\n  | \"minHeight\"\n  | \"maxWidth\"\n  | \"maxHeight\"\n  | \"maxHeightMoveUp\"\n  | \"maxWidthMoveLeft\";\n```\n\nDefined in: [dd-gridstack.ts:32](https://github.com/adumesny/gridstack.js/blob/master/src/dd-gridstack.ts#L32)\n\nKeys for DD configuration options that can be set via the 'option' command.\n\n***\n\n<a id=\"ddopts\"></a>\n### DDOpts\n\n```ts\ntype DDOpts = \"enable\" | \"disable\" | \"destroy\" | \"option\" | string | any;\n```\n\nDefined in: [dd-gridstack.ts:27](https://github.com/adumesny/gridstack.js/blob/master/src/dd-gridstack.ts#L27)\n\nDrag & Drop operation types used throughout the DD system.\r\nCan be control commands or configuration objects.\n\n***\n\n<a id=\"ddvalue\"></a>\n### DDValue\n\n```ts\ntype DDValue = number | string;\n```\n\nDefined in: [dd-gridstack.ts:37](https://github.com/adumesny/gridstack.js/blob/master/src/dd-gridstack.ts#L37)\n\nValues for DD configuration options (numbers or strings with units).\n\n***\n\n<a id=\"eventcallback\"></a>\n### EventCallback()\n\n```ts\ntype EventCallback = (event) => boolean | void;\n```\n\nDefined in: [dd-base-impl.ts:10](https://github.com/adumesny/gridstack.js/blob/master/src/dd-base-impl.ts#L10)\n\nType for event callback functions used in drag & drop operations.\nCan return boolean to indicate if the event should continue propagation.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `event` | `Event` |\n\n#### Returns\n\n`boolean` \\| `void`\n\n***\n\n<a id=\"gridstackdroppedhandler\"></a>\n### GridStackDroppedHandler()\n\n```ts\ntype GridStackDroppedHandler = (event, previousNode, newNode) => void;\n```\n\nDefined in: [types.ts:104](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L104)\n\nDrop event handler that receives previous and new node states\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `event` | `Event` |\n| `previousNode` | [`GridStackNode`](#gridstacknode-2) |\n| `newNode` | [`GridStackNode`](#gridstacknode-2) |\n\n#### Returns\n\n`void`\n\n***\n\n<a id=\"gridstackelement\"></a>\n### GridStackElement\n\n```ts\ntype GridStackElement = string | GridItemHTMLElement;\n```\n\nDefined in: [types.ts:87](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L87)\n\nType representing various ways to specify grid elements.\r\nCan be a CSS selector string, GridItemHTMLElement (HTML element with GS variables when loaded).\n\n***\n\n<a id=\"gridstackelementhandler\"></a>\n### GridStackElementHandler()\n\n```ts\ntype GridStackElementHandler = (event, el) => void;\n```\n\nDefined in: [types.ts:98](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L98)\n\nElement-specific event handler that receives event and affected element\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `event` | `Event` |\n| `el` | [`GridItemHTMLElement`](#griditemhtmlelement) |\n\n#### Returns\n\n`void`\n\n***\n\n<a id=\"gridstackevent\"></a>\n### GridStackEvent\n\n```ts\ntype GridStackEvent = \n  | \"added\"\n  | \"change\"\n  | \"disable\"\n  | \"drag\"\n  | \"dragstart\"\n  | \"dragstop\"\n  | \"dropped\"\n  | \"enable\"\n  | \"removed\"\n  | \"resize\"\n  | \"resizestart\"\n  | \"resizestop\"\n  | \"resizecontent\";\n```\n\nDefined in: [gridstack.ts:46](https://github.com/adumesny/gridstack.js/blob/master/src/gridstack.ts#L46)\n\nlist of possible events, or space separated list of them\n\n***\n\n<a id=\"gridstackeventhandler\"></a>\n### GridStackEventHandler()\n\n```ts\ntype GridStackEventHandler = (event) => void;\n```\n\nDefined in: [types.ts:95](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L95)\n\nGeneral event handler that receives only the event\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `event` | `Event` |\n\n#### Returns\n\n`void`\n\n***\n\n<a id=\"gridstackeventhandlercallback\"></a>\n### GridStackEventHandlerCallback\n\n```ts\ntype GridStackEventHandlerCallback = \n  | GridStackEventHandler\n  | GridStackElementHandler\n  | GridStackNodesHandler\n  | GridStackDroppedHandler;\n```\n\nDefined in: [types.ts:107](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L107)\n\nUnion type of all possible event handler types\n\n***\n\n<a id=\"gridstacknodeshandler\"></a>\n### GridStackNodesHandler()\n\n```ts\ntype GridStackNodesHandler = (event, nodes) => void;\n```\n\nDefined in: [types.ts:101](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L101)\n\nNode-based event handler that receives event and array of affected nodes\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `event` | `Event` |\n| `nodes` | [`GridStackNode`](#gridstacknode-2)[] |\n\n#### Returns\n\n`void`\n\n***\n\n<a id=\"numberorstring\"></a>\n### numberOrString\n\n```ts\ntype numberOrString = number | string;\n```\n\nDefined in: [types.ts:71](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L71)\n\nType representing values that can be either numbers or strings (e.g., dimensions with units).\r\nUsed for properties like width, height, margins that accept both numeric and string values.\n\n***\n\n<a id=\"renderfcn\"></a>\n### RenderFcn()\n\n```ts\ntype RenderFcn = (el, w) => void;\n```\n\nDefined in: [types.ts:137](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L137)\n\nOptional callback function for custom widget content rendering.\r\nCalled during load()/addWidget() to create custom content beyond plain text.\n\n#### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `el` | `HTMLElement` | The widget's content container element |\n| `w` | [`GridStackWidget`](#gridstackwidget) | The widget definition with content and other properties |\n\n#### Returns\n\n`void`\n\n***\n\n<a id=\"resizetocontentfcn\"></a>\n### ResizeToContentFcn()\n\n```ts\ntype ResizeToContentFcn = (el) => void;\n```\n\nDefined in: [types.ts:145](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L145)\n\nOptional callback function for custom resize-to-content behavior.\r\nCalled when a widget needs to resize to fit its content.\n\n#### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `el` | [`GridItemHTMLElement`](#griditemhtmlelement) | The grid item element to resize |\n\n#### Returns\n\n`void`\n\n***\n\n<a id=\"savefcn\"></a>\n### SaveFcn()\n\n```ts\ntype SaveFcn = (node, w) => void;\n```\n\nDefined in: [types.ts:128](https://github.com/adumesny/gridstack.js/blob/master/src/types.ts#L128)\n\nOptional callback function called during save() operations.\r\nAllows adding custom data to the saved widget structure.\n\n#### Parameters\n\n| Parameter | Type | Description |\n| ------ | ------ | ------ |\n| `node` | [`GridStackNode`](#gridstacknode-2) | The internal grid node |\n| `w` | [`GridStackWidget`](#gridstackwidget) | The widget structure being saved (can be modified) |\n\n#### Returns\n\n`void`\n"
  },
  {
    "path": "doc/CHANGES.md",
    "content": "Change log\n==========================\n\n<!-- START doctoc generated TOC please keep comment here to allow auto update -->\n<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->\n**Table of Contents**  *generated with [DocToc](http://doctoc.herokuapp.com/)*\n\n- [12.4.2 (2025-12-26)](#1242-2025-12-26)\n- [12.4.1 (2025-12-12)](#1241-2025-12-12)\n- [12.3.3 (2025-08-13)](#1233-2025-08-13)\n- [12.3.2 (2025-08-12)](#1232-2025-08-12)\n- [12.3.1 (2025-08-11)](#1231-2025-08-11)\n- [12.3.0 (2025-08-10)](#1230-2025-08-10)\n- [12.2.2 (2025-07-06)](#1222-2025-07-06)\n- [12.2.1 (2025-05-28)](#1221-2025-05-28)\n- [12.2.0 (2025-05-27)](#1220-2025-05-27)\n- [12.1.2 (2024-05-07)](#1212-2024-05-07)\n- [12.1.1 (2024-04-28)](#1211-2024-04-28)\n- [12.1.0 (2024-04-23)](#1210-2024-04-23)\n- [12.0.0 (2025-04-12)](#1200-2025-04-12)\n- [11.5.1 (2025-03-23)](#1151-2025-03-23)\n- [11.5.0 (2025-03-16)](#1150-2025-03-16)\n- [11.4.0 (2025-02-27)](#1140-2025-02-27)\n- [11.3.0 (2025-01-26)](#1130-2025-01-26)\n- [11.2.0 (2024-12-29)](#1120-2024-12-29)\n- [11.1.2 (2024-12-08)](#1112-2024-12-08)\n- [11.1.1 (2024-11-26)](#1111-2024-11-26)\n- [11.1.0 (2024-11-17)](#1110-2024-11-17)\n- [11.0.1 (2024-10-21)](#1101-2024-10-21)\n- [11.0.0 (2024-10-20)](#1100-2024-10-20)\n- [10.3.1 (2024-07-21)](#1031-2024-07-21)\n- [10.3.0 (2024-06-26)](#1030-2024-06-26)\n- [10.2.1 (2024-06-23)](#1021-2024-06-23)\n- [10.2.0 (2024-06-02)](#1020-2024-06-02)\n- [10.1.2 (2024-03-30)](#1012-2024-03-30)\n- [10.1.1 (2024-03-03)](#1011-2024-03-03)\n- [10.1.0 (2024-02-04)](#1010-2024-02-04)\n- [10.0.1 (2023-12-10)](#1001-2023-12-10)\n- [10.0.0 (2023-11-20)](#1000-2023-11-20)\n- [9.5.1 (2023-11-11)](#951-2023-11-11)\n- [9.5.0 (2023-10-26)](#950-2023-10-26)\n- [9.4.0 (2023-10-15)](#940-2023-10-15)\n- [9.3.0 (2023-09-30)](#930-2023-09-30)\n- [9.2.2 (2023-09-27)](#922-2023-09-27)\n- [9.2.1 (2023-09-20)](#921-2023-09-20)\n- [9.2.0 (2023-09-10)](#920-2023-09-10)\n- [9.1.1 (2023-09-06)](#911-2023-09-06)\n- [9.1.0 (2023-09-04)](#910-2023-09-04)\n- [9.0.2 (2023-08-29)](#902-2023-08-29)\n- [9.0.1 (2023-08-27)](#901-2023-08-27)\n- [9.0.0 (2023-08-23)](#900-2023-08-23)\n- [8.4.0 (2023-07-20)](#840-2023-07-20)\n- [8.3.0 (2023-06-13)](#830-2023-06-13)\n- [8.2.3 (2023-06-11)](#823-2023-06-11)\n- [8.2.1 (2023-05-26)](#821-2023-05-26)\n- [8.2.0 (2023-05-24)](#820-2023-05-24)\n- [8.1.2 (2023-05-22)](#812-2023-05-22)\n- [8.1.1 (2023-05-13)](#811-2023-05-13)\n- [8.1.0 (2023-05-06)](#810-2023-05-06)\n- [8.0.1 (2023-04-29)](#801-2023-04-29)\n- [8.0.0 (2023-04-29)](#800-2023-04-29)\n- [7.3.0 (2023-04-01)](#730-2023-04-01)\n- [7.2.3 (2023-02-02)](#723-2023-02-02)\n- [7.2.2 (2023-01-16)](#722-2023-01-16)\n- [7.2.1 (2023-01-14)](#721-2023-01-14)\n- [7.2.0 (2023-01-07)](#720-2023-01-07)\n- [7.1.2 (2022-12-29)](#712-2022-12-29)\n- [7.1.1 (2022-11-13)](#711-2022-11-13)\n- [7.1.0 (2022-10-23)](#710-2022-10-23)\n- [7.0.1 (2022-10-14)](#701-2022-10-14)\n- [7.0.0 (2022-10-09)](#700-2022-10-09)\n- [6.0.3 (2022-10-08)](#603-2022-10-08)\n- [6.0.2 (2022-09-23)](#602-2022-09-23)\n- [6.0.1 (2022-08-27)](#601-2022-08-27)\n- [6.0.0 (2022-08-21)](#600-2022-08-21)\n- [5.1.1 (2022-06-16)](#511-2022-06-16)\n- [5.1.0 (2022-05-21)](#510-2022-05-21)\n- [5.0.0 (2022-01-10)](#500-2022-01-10)\n- [4.4.1 (2021-12-24)](#441-2021-12-24)\n- [4.4.0 (2021-12-21)](#440-2021-12-21)\n- [4.3.1 (2021-10-18)](#431-2021-10-18)\n- [4.3.0 (2021-10-15)](#430-2021-10-15)\n- [4.2.7 (2021-9-12)](#427-2021-9-12)\n- [4.2.6 (2021-7-11)](#426-2021-7-11)\n- [4.2.5 (2021-5-31)](#425-2021-5-31)\n- [4.2.4 (2021-5-29)](#424-2021-5-29)\n- [4.2.3 (2021-5-8)](#423-2021-5-8)\n- [4.2.2 (2021-4-23)](#422-2021-4-23)\n- [4.2.1 (2021-4-18)](#421-2021-4-18)\n- [4.2.0 (2021-4-11)](#420-2021-4-11)\n- [4.1.0 (2021-4-7)](#410-2021-4-7)\n- [4.0.3 (2021-3-28)](#403-2021-3-28)\n- [4.0.2 (2021-3-27)](#402-2021-3-27)\n- [4.0.1 (2021-3-20)](#401-2021-3-20)\n- [4.0.0 (2021-3-19)](#400-2021-3-19)\n- [3.3.0 (2021-2-2)](#330-2021-2-2)\n- [3.2.0 (2021-1-25)](#320-2021-1-25)\n- [3.1.5 (2021-1-23)](#315-2021-1-23)\n- [3.1.4 (2021-1-11)](#314-2021-1-11)\n- [3.1.3 (2021-1-2)](#313-2021-1-2)\n- [3.1.2 (2020-12-7)](#312-2020-12-7)\n- [3.1.0 (2020-12-4)](#310-2020-12-4)\n- [3.0.0 (2020-11-29)](#300-2020-11-29)\n- [2.2.0 (2020-11-7)](#220-2020-11-7)\n- [2.1.0 (2020-10-28)](#210-2020-10-28)\n- [2.0.2 (2020-10-05)](#202-2020-10-05)\n- [2.0.1 (2020-09-26)](#201-2020-09-26)\n- [2.0.0 (2020-09-07)](#200-2020-09-07)\n- [1.2.1 (2020-09-04)](#121-2020-09-04)\n- [1.2.0 (2020-08-01)](#120-2020-08-01)\n- [1.1.2 (2020-05-17)](#112-2020-05-17)\n- [1.1.1 (2020-03-17)](#111-2020-03-17)\n- [1.1.0 (2020-02-29)](#110-2020-02-29)\n- [v1.0.0 (2020-02-23)](#v100-2020-02-23)\n- [v0.6.4 (2020-02-17)](#v064-2020-02-17)\n- [v0.6.3 (2020-02-05)](#v063-2020-02-05)\n- [v0.6.2 (2020-02-03)](#v062-2020-02-03)\n- [v0.6.1 (2020-02-02)](#v061-2020-02-02)\n- [v0.6.0 (2019-12-24)](#v060-2019-12-24)\n- [v0.5.5 (2019-11-27)](#v055-2019-11-27)\n- [v0.5.4 (2019-11-26)](#v054-2019-11-26)\n- [v0.5.3 (2019-11-20)](#v053-2019-11-20)\n- [v0.5.2 (2019-11-13)](#v052-2019-11-13)\n- [v0.5.1 (2019-11-07)](#v051-2019-11-07)\n- [v0.5.0 (2019-11-06)](#v050-2019-11-06)\n- [v0.4.0 (2018-05-11)](#v040-2018-05-11)\n- [v0.3.0 (2017-04-21)](#v030-2017-04-21)\n- [v0.2.6 (2016-08-17)](#v026-2016-08-17)\n- [v0.2.5 (2016-03-02)](#v025-2016-03-02)\n- [v0.2.4 (2016-02-15)](#v024-2016-02-15)\n- [v0.2.3 (2015-06-23)](#v023-2015-06-23)\n- [v0.2.2 (2014-12-23)](#v022-2014-12-23)\n- [v0.2.1 (2014-12-09)](#v021-2014-12-09)\n- [v0.2.0 (2014-11-30)](#v020-2014-11-30)\n- [v0.1.0 (2014-11-18)](#v010-2014-11-18)\n\n<!-- END doctoc generated TOC please keep comment here to allow auto update -->\n## 12.4.3 (TBD)\n* fix: [#3237](https://github.com/gridstack/gridstack.js/pull/3237) updateOptions() fixes for columnOpts, maxRow. load() not cloning\n* fix: [#3241](https://github.com/gridstack/gridstack.js/pull/3241) drifting rounding issue when cellHeight is small/fraction\n\n## 12.4.2 (2025-12-26)\n* regression: [#3214](https://github.com/gridstack/gridstack.js/issues/3214) touch device with real mouse event fix (caused by #3191 in last release)\n\n## 12.4.1 (2025-12-12)\n* feat: [#3104](https://github.com/gridstack/gridstack.js/issues/3104) Custom resize div element target - thank you [Marvin Heilemann](https://github.com/muuvmuuv)\n* fix: [#3181](https://github.com/gridstack/gridstack.js/issues/3181) re-initing from DOM missing x:0, y:0 messing layout\n* fix: [#3191](https://github.com/gridstack/gridstack.js/pull/3191) touch issue on Linux\n* fix: [#3194](https://github.com/gridstack/gridstack.js/pull/3194) `updateOption()` update lazyLoad\n* fix: [#3201](https://github.com/gridstack/gridstack.js/pull/3201) updating higher column layout can cause negative values in `layoutsNodesChange()`\n\n## 12.3.3 (2025-08-13)\n* fix: [#3139](https://github.com/gridstack/gridstack.js/pull/3139) `Utils:removeInternalForSave()` to skip arrays\n\n## 12.3.2 (2025-08-12)\n* fix: [#3136](https://github.com/gridstack/gridstack.js/pull/3136) more tweaks to save(columnCount) option. \n\n## 12.3.1 (2025-08-11)\n* fix: [#2493](https://github.com/gridstack/gridstack.js/issues/2493) added save(columnCount) option. Nested grid now use container saved column count. \n\n## 12.3.0 (2025-08-10)\n* feat: [#3047](https://github.com/gridstack/gridstack.js/issues/3047) added `.grid-stack-dragging` to grid when child is being dragged so we can set `cursor:grabbing`. Updated demo.\n* feat: now using typedoc to generate doc (HTML and markup) from code. improved code examples and comments.\n* fix: [#3099](https://github.com/gridstack/gridstack.js/issues/3099) scroll take into account ScrollContainer position\n* fix: [#3102](https://github.com/gridstack/gridstack.js/pull/3102) React demo now support multiple grids\n* fix: [#3021](https://github.com/gridstack/gridstack.js/issues/3021) correctly reset widget back (to last known position) when released outside\n\n## 12.2.2 (2025-07-06)\n* fix: [#3070](https://github.com/gridstack/gridstack.js/pull/3070) incorrect property name 'sizeToContent' when cleaning up invalid attributes\n* fix: [#3077](https://github.com/gridstack/gridstack.js/pull/3077) incorrect node._id check\n* fix: [#3054](https://github.com/gridstack/gridstack.js/pull/3054) Avoid reflows via explicitly setting minRow\n* fix: [#3085](https://github.com/gridstack/gridstack.js/issues/3085) `opts.minRow` being updated\n\n## 12.2.1 (2025-05-28)\n* fix: [#3064](https://github.com/gridstack/gridstack.js/pull/3064) fix `GridStack.updateCB(w)` crash\n\n## 12.2.0 (2025-05-27)\n* feat: [#3061](https://github.com/gridstack/gridstack.js/pull/3061) added `GridStack.updateCB(w)` that gets called after a widget has been updated (eg: load() after initial layout) instead of created\n\n## 12.1.2 (2024-05-07)\n* fix [#3043](https://github.com/gridstack/gridstack.js/issues/3043) fix `opts.animate` again\n* fix [#3048](https://github.com/gridstack/gridstack.js/pull/3048) nested grid resizeToContentCBCheck() fix\n\n## 12.1.1 (2024-04-28)\n* fix [#3038](https://github.com/gridstack/gridstack.js/pull/3038) `updateOptions()` fix opts.minRow being undefined\n\n## 12.1.0 (2024-04-23)\n* feat [#2671](https://github.com/gridstack/gridstack.js/issues/2671) subgrid now propagate events to topmost grid. Use `el.gridstackNode.grid` to know which (sub) grid.\n* fix [#3028](https://github.com/gridstack/gridstack.js/pull/3028) `updateOptions()` no longer modifies passed in struct. only field we check are being handled too.\n* fix [#3029](https://github.com/gridstack/gridstack.js/pull/3029) `resizeToContent()` fix for nested grid with content above\n* fix [#3030](https://github.com/gridstack/gridstack.js/pull/3030) `resizeToContentCheck()` wasn't blocking _ignoreLayoutsNodeChange at end of the loop\n* rem [#3022](https://github.com/gridstack/gridstack.js/pull/3022) removed ES5 support (IE doesn't support CSS vars needed now)\n* rem [#3027](https://github.com/gridstack/gridstack.js/pull/3027) remove legacy code support for disableOneColumnMode, oneColumnSize, oneColumnModeDomSort\n\n## 12.0.0 (2025-04-12)\n* feat: [#2854](https://github.com/gridstack/gridstack.js/pull/2854) Removed dynamic stylesheet and migrated to CSS vars. Thank you [lmartorella](https://github.com/lmartorella)\n* feat: [#3013](https://github.com/gridstack/gridstack.js/pull/3013) columns no longer require custom classes nor `gridstack-extra.css` as we now use CSS vars.\n* fix: [#2978](https://github.com/gridstack/gridstack.js/issues/2978) Very slow operation in 11.2.0 and higher with large blocks\n* fix: [#2947](https://github.com/gridstack/gridstack.js/issues/2947) loading responsive `layout:'list'` into smaller screen doesn't layout correctly.\n\n## 11.5.1 (2025-03-23)\n* revert: [#2981](https://github.com/gridstack/gridstack.js/issues/2981) Locked was incorrectly changed. fixed doc instead\n\n## 11.5.0 (2025-03-16)\n* feat: [#2975](https://github.com/gridstack/gridstack.js/pull/2975) `prepareDragDrop(el, force)` option to force re-creation of the drag&drop event binding\n* feat: [#2989](https://github.com/gridstack/gridstack.js/pull/2989) new `updateOptions(o: GridStackOptions)` to update PARTIAL list of options after grid as been created\n* fix: [#2980](https://github.com/gridstack/gridstack.js/issues/2980) dd-touch circular dependency\n* fix: [#2667](https://github.com/gridstack/gridstack.js/issues/2667) sidebar items not honoring gs-w (enter-leave-re-enter)\n* fix: [#2987](https://github.com/gridstack/gridstack.js/issues/2987) gs-size-to-content to support numbers\n* fix: [#2981](https://github.com/gridstack/gridstack.js/issues/2981) Locked not working as expected\n\n## 11.4.0 (2025-02-27)\n* fix: [#2921](https://github.com/gridstack/gridstack.js/pull/2921) replace initMouseEvent with MouseEvent constructor and added composed: true\n* fix: [#2939](https://github.com/gridstack/gridstack.js/issues/2939) custom drag handle not working with LazyLoad\n* fix: [#2955](https://github.com/gridstack/gridstack.js/issues/2955) angular circular dependency\n* fix: [#2951](https://github.com/gridstack/gridstack.js/issues/2951) shadow DOM dragging re-appending fix\n* fix: [#2964](https://github.com/gridstack/gridstack.js/pull/2964) minW larger than column fix\n* feat: [#2965](https://github.com/gridstack/gridstack.js/pull/2965) internal `_prepareDragDropByNode(n)` is now public as `prepareDragDrop(el)` so Angular, React, and others can call once the DOM content elements have been added (the outside grid item divs are always created before content)\n* break: [#2959](https://github.com/gridstack/gridstack.js/issues/2959) `Util.createWidgetDivs()` has moved to `GridStack.createWidgetDivs()` to remove circular dependencies\n\n## 11.3.0 (2025-01-26)\n* feat: added `isIgnoreChangeCB()` if changeCB should be ignored due to column change, sizeToContent, loading, etc...\n* feat: added `responsive_none.html` demo and fixed layout:'none' to bound check the layout (no-op unless it must change)\n\n## 11.2.0 (2024-12-29)\n* feat: [#2695](https://github.com/gridstack/gridstack.js/issues/2695) 'Esc' to cancel now works on sidebar external items, also works dragging over trash.\n* feat: [#2852](https://github.com/gridstack/gridstack.js/pull/2852) better React example. Thank you [CNine](https://github.com/Aysnine)\n* fix: [#2852](https://github.com/gridstack/gridstack.js/pull/2852) grid in tabs correctly handles CSS. Thank you [Luciano Martorella](https://github.com/lmartorella)\n* fix: [#2900](https://github.com/gridstack/gridstack.js/issues/2900) use attr `data-gs-widget` instead of `gridstacknode` (supported as well for backward compatibility)\n\n## 11.1.2 (2024-12-08)\n* fix: [#2877](https://github.com/gridstack/gridstack.js/pull/2877) angular wrapper uses standalone, while now being compatible down to ng14. thanks to [andre-steudel](https://github.com/andre-steudel)\n* fix: [#2886](https://github.com/gridstack/gridstack.js/issues/2886) added `gs-size-to-content` support\n* fix: [#2887](https://github.com/gridstack/gridstack.js/issues/2887) mobile nested grid TypeError: e.currentTarget is null\n\n## 11.1.1 (2024-11-26)\n* fix: [#2878](https://github.com/gridstack/gridstack.js/pull/2878) make sure sub-grid inherit parent opts by default, with subgrid defaults.\n* fix: [#2879](https://github.com/gridstack/gridstack.js/pull/2879) sub-grid item `sizeToContent:true` now handle content above/below sub grid.\n\n## 11.1.0 (2024-11-17)\n* feat: [#2864](https://github.com/gridstack/gridstack.js/issues/2864) added `GridStackOptions.layout` for nested grid reflow during resize. default to 'list'.\n* fix: [#2859](https://github.com/gridstack/gridstack.js/pull/2859) re-enabled tests and fix numerous issues found (see CL). Also thank you [Luciano Martorella](https://github.com/lmartorella) for getting me going and starting it.\n* fix: [#2851](https://github.com/gridstack/gridstack.js/pull/2851) added support for custom max layout saving - Thank you [Luciano Martorella](https://github.com/lmartorella)\n* fix: [#2492](https://github.com/gridstack/gridstack.js/issues/2492) loading same layout with overlapping widget fix. v10.3.0 regression.\n\n## 11.0.1 (2024-10-21)\n* fix: [#2834](https://github.com/gridstack/gridstack.js/pull/2834) v11 angular missing package.json\n* fix: [#2835](https://github.com/gridstack/gridstack.js/bug/2835) make sure we have unique USER id\n\n## 11.0.0 (2024-10-20)\n* feat: [#2826](https://github.com/gridstack/gridstack.js/pull/2826) Lazy loading of widget content until visible (`GridStackOptions.lazyLoad` and `GridStackWidget.lazyLoad`)\n* feat: [#2818](https://github.com/gridstack/gridstack.js/pull/2818) support for Angular Component hosting true sub-grids (that size according to parent) without requring them to be only child of grid-item-content.\n* fix: [#2231](https://github.com/gridstack/gridstack.js/bug/2231),[#1840](https://github.com/gridstack/gridstack.js/bug/1840),[#2354](https://github.com/gridstack/gridstack.js/bug/2354)\nbig overall to how we do sidepanel drag&drop helper. see release notes.\n* fix: [#2736](https://github.com/gridstack/gridstack.js/bug/2736) safe practices around GridStackWidget.content no longer setting innerHTML\n\n## 10.3.1 (2024-07-21)\n* fix: [#2734](https://github.com/gridstack/gridstack.js/bug/2734) rotate() JS error\n* fix: [#2741](https://github.com/gridstack/gridstack.js/pull/2741) resizeToContent JS error with nested grid\n* fix: [#2740](https://github.com/gridstack/gridstack.js/bug/2740) nested grid drag fix\n* fix: [#2730](https://github.com/gridstack/gridstack.js/bug/2730) resizing left from right most item works\n* fix: [#2327](https://github.com/gridstack/gridstack.js/bug/2327) remove dataTransfer mention as not supported\n\n## 10.3.0 (2024-06-26)\n* fix: [#2720](https://github.com/gridstack/gridstack.js/pull/2720) load() now creates widgets in order (used to be reverse due to old collision code)\n\n## 10.2.1 (2024-06-23)\n* fix: [#2683](https://github.com/gridstack/gridstack.js/issues/2683) check for fixed grid maxRow during resize\n* fix: [#2694](https://github.com/gridstack/gridstack.js/issues/2694) prevent 'r' rotation to items that can't resize (locked, noResize, fixed sizes)\n* fix: [#2709](https://github.com/gridstack/gridstack.js/pull/2709) support for multiple drag targets - Thank you [nickfulcher](https://github.com/nickfulcher)\n* fix: [#2669](https://github.com/gridstack/gridstack.js/issues/2669) load() sometimes restore incorrectly\n\n## 10.2.0 (2024-06-02)\n* feat: [#2682](https://github.com/gridstack/gridstack.js/pull/2682) You can now press 'Esc' to cancel a move|resize, 'r' to rotate during a drag. added `GridStack.rotate()` as well - Thank you John B. for this feature sponsor.\n* fix: [#2672](https://github.com/gridstack/gridstack.js/pull/2672) dropping into full grid JS error\n* fix: [#2676](https://github.com/gridstack/gridstack.js/issues/2676) handle minW resizing when column count is less\n* fix: [#2677](https://github.com/gridstack/gridstack.js/issues/2677) allow button as handle dragging\n\n## 10.1.2 (2024-03-30)\n* fix: [#2628](https://github.com/gridstack/gridstack.js/issues/2628) `removeAll()` does not trigger Angular's ngOnDestroy \n* fix: [#2503](https://github.com/gridstack/gridstack.js/issues/2503) Drag and drop a widget on top of a locked widget - Thank you [JakubEleniuk](https://github.com/JakubEleniuk)\n* fix: [#2584](https://github.com/gridstack/gridstack.js/issues/2584) wrong sort order during 1 column resize - Thank you [JakubEleniuk](https://github.com/JakubEleniuk) again.\n* fix: [#2639](https://github.com/gridstack/gridstack.js/issues/2639) load() with mix of new item without coordinates\n* fix: [#2633](https://github.com/gridstack/gridstack.js/issues/2633) Drop into full grid causes crash\n* fix: [#2559](https://github.com/gridstack/gridstack.js/issues/2559) changed angular demos (support 1 column)\n* fix: [#2453](https://github.com/gridstack/gridstack.js/issues/2453) recreated grid trash issue\n\n## 10.1.1 (2024-03-03)\n* fix: [#2620](https://github.com/gridstack/gridstack.js/pull/2620) allow resizing with sizeToContent:NUMBER is uses \n\n## 10.1.0 (2024-02-04)\n* feat: [#2574](https://github.com/gridstack/gridstack.js/pull/2574) Allow cell height in cm and mm units\n* feat: [#2578](https://github.com/gridstack/gridstack.js/pull/2578) allow different scaling between drag toolbar and grid\n* fix: [#2577](https://github.com/gridstack/gridstack.js/issues/2577) ui-resizable-s/-n style fix\n* fix: [#2576](https://github.com/gridstack/gridstack.js/issues/2576) column('none') now ignores layouts\n* fix: [#2560](https://github.com/gridstack/gridstack.js/issues/2560) nested grid fix (enter can call leave which can call enter again) - Thank you [v1talii-dev](https://github.com/v1talii-dev)\n* fix: [#2596](https://github.com/gridstack/gridstack.js/pull/2596) prevent SSR crash\n* fix: [#2610](https://github.com/gridstack/gridstack.js/pull/2610) using passive:true for mousemove events\n* fix: [#2612](https://github.com/gridstack/gridstack.js/pull/2612) restrict vertical resize if `sizeToContent:true`\n* demo: nested.htm now has nested create and drag&drop example - Thank you [fredericrous](https://github.com/fredericrous)\n\n## 10.0.1 (2023-12-10)\n* fix: [#2552](https://github.com/gridstack/gridstack.js/issues/2552) DOM init doesn't sizeToContent\n* fix: [#2561](https://github.com/gridstack/gridstack.js/pull/2561) issues with sizeToContent animation, cleanup, etc...\n* fix: [#2427](https://github.com/gridstack/gridstack.js/issues/2427) sizeToContent supports rem/em cell height\n* fix: [#2558](https://github.com/gridstack/gridstack.js/pull/2558) remove style node in shadow root\n* fix: [#2556](https://github.com/gridstack/gridstack.js/pull/2556) make sure 'new GridStack(el)' set el.gridstack=this right away\n* cleanup: [#2550](https://github.com/gridstack/gridstack.js/pull/2550) Optimize resize arrow (~88% lighter from 1.82 KB to 225B)\n\n## 10.0.0 (2023-11-20)\n* feat [#2542](https://github.com/gridstack/gridstack.js/pull/2542) we now support much richer responsive behavior with `GridStackOptions.columnOpts` including any breakpoint width:column pairs, or automatic column sizing. \n* `disableOneColumnMode`, `oneColumnSize`, `oneColumnModeDomSort` have been removed (see v10 migration doc)\n\n## 9.5.1 (2023-11-11)\n* fix [#2525](https://github.com/gridstack/gridstack.js/commit/2525) Fixed unhandled exception happening in _mouseMove handler\n* fix potential crash in resizeToContentCheck() if grid gets deleted by the time the delay happens\n* fix [#2527](https://github.com/gridstack/gridstack.js/issues/2527) Incorrect layout on grid load in one column mode\n* fix [#2496](https://github.com/gridstack/gridstack.js/issues/2496) animation on init, introduced in 8.1.1\n\n## 9.5.0 (2023-10-26)\n* feat [#1275](https://github.com/gridstack/gridstack.js/issues/1275) div scale support - Thank you [elmehdiamlou](https://github.com/elmehdiamlou) for implementing this teh right way (add scale to current code)\n* fix [#2489](https://github.com/gridstack/gridstack.js/commit/2489) moved the dropped event handler to after doing everything (no more setTimeout) - Thanks [arnoudb](https://github.com/arnoudb) for suggesting a fix.\n* fix [#2497](https://github.com/gridstack/gridstack.js/issues/2497) Utils.parseHeight() fix\n* fix column(1) to not restore if disableOneColumnMode on size change\n\n## 9.4.0 (2023-10-15)\n* revert [#2263](https://github.com/gridstack/gridstack.js/issues/2263) div scale support - causing too many issues for now (#2498 #2491)\n* fix [#2492](https://github.com/gridstack/gridstack.js/issues/2492) calling load() allows overlapping widgets\n\n## 9.3.0 (2023-09-30)\n* fix [#1275](https://github.com/gridstack/gridstack.js/issues/1275) div scale support - Thank you [VincentMolinie](https://github.com/VincentMolinie) for implementing this\n\n## 9.2.2 (2023-09-27)\n* fix - sub-grid styles now look for immediate correct parent, not any depth above.\n* fix [#2469](https://github.com/gridstack/gridstack.js/issues/2469) \"Invalid height\" error CSS minHeight\n* fix [#2394](https://github.com/gridstack/gridstack.js/issues/2394) nested grid size issue when sub-items moved up/down\n\n## 9.2.1 (2023-09-20)\n* fix _updateContainerHeight() to use height rather than min-height again (apart for nested grids which need it) and partial getComputedStyle CSS minHeight support\n\n## 9.2.0 (2023-09-10)\n* feat: nested grids now support `sizeToContent` to size themselves to how many sub items they contain - Thank you [@Helix](https://gridstackjs.slack.com/team/U05QT7G8H7T) for sponsoring this!\n* fix [#2449](https://github.com/gridstack/gridstack.js/issues/2449) full grid maxRow fix\n\n## 9.1.1 (2023-09-06)\n* fix [#2435](https://github.com/gridstack/gridstack.js/issues/2435) directionCollideCoverage() tweaks\n* fix resizeToContent() to handle node.h (using when cellHeight changes or we resize) vs DOM sizing (rest of the time)\n\n## 9.1.0 (2023-09-04)\n* renamed fitToContent to sizeToContent (API BREAK)\n* feat: `sizeToContent` now supports being `boolean|number` to limit the height but user can resize past that, unlike maxH.\n* feat: `resizeToContentParent` now on GridStackWidget for those widgets that need to resize differently.\n\n## 9.0.2 (2023-08-29)\n* fix 'resizecontent' event fix not called.\n* partial fix [#2427](https://github.com/gridstack/gridstack.js/issues/2427) sizeToContent when calling cellHeight()/addWidget()/MakeWidget()\n\n## 9.0.1 (2023-08-27)\n* fix [#2413](https://github.com/gridstack/gridstack.js/issues/2413) support touchscreen+mouse devices. Thank you [@Ruslan207](https://github.com/Ruslan207)\n* tweak to `sizeToContent` from [#2412](https://github.com/gridstack/gridstack.js/pull/2412#issuecomment-1690219018). Thank you [@JonSohn](https://github.com/JonSohn)\n\n## 9.0.0 (2023-08-23)\n- feat [#404](https://github.com/gridstack/gridstack.js/issues/404) added `GridStackOptions.sizeToContent` and `GridStackWidget.sizeToContent` to make gridItems size themselves to their content (no scroll bar), calling `GridStack.resizeToContent(el)` whenever the grid or item is resized.\n- also added new `'resizecontent'` event, and `resizeToContentCB` and `resizeToContentParent` vars.\n- fix [#2406](https://github.com/gridstack/gridstack.js/issues/2406) inf loop when autoPosition after loading into 1 column, then 2.\n\n## 8.4.0 (2023-07-20)\n* feat [#2378](https://github.com/gridstack/gridstack.js/pull/2378) attribute `DDRemoveOpt.decline` to deny the removal of a specific class.\n* fix: dragging onto trash now calls removeWidget() and therefore `GridStack.addRemoveCB` (for component cleanup)\n* feat: `load()` support re-order loading without explicit coordinates (`autoPosition` or missing `x,y`) uses passed order.\n\n## 8.3.0 (2023-06-13)\n* feat [#2358](https://github.com/gridstack/gridstack.js/issues/2358) column(N, 'list'|'compact'|...) resizing now support reflowing content as list\n\n## 8.2.3 (2023-06-11)\n* fix [#2349](https://github.com/gridstack/gridstack.js/issues/2349) grid NoMove vs item NoMove support\n* fix [#2352](https://github.com/gridstack/gridstack.js/issues/2352) .ui-draggable-dragging z-index for modal dialogs\n* fix [#2357](https://github.com/gridstack/gridstack.js/issues/2357) NaN inf loop when using cellHeight rem/em\n* fix [#2354](https://github.com/gridstack/gridstack.js/issues/2354) max-w cloning issue fix\n\n## 8.2.1 (2023-05-26)\n* fix: make sure `removeNode()` uses internal _id (unique) and not node itself (since we clone those often)\n* fix: after calling `addRemoveCB` make sure we don't makeWidget() (incorrectly) a second time\n* break: `GridStackWidget.id` is now string only (used to be numberOrString) as it causes usage to have to check and cast\n\n## 8.2.0 (2023-05-24)\n* feat: `makeWidget()` now take optional `GridStackWidget` for sizing\n* fix: make sure `GridStack.saveCB` is call in `removeWidget()`\n* feat: angular wrapper: serialize custom data support, and making sure destroy() is called on ng components\n\n## 8.1.2 (2023-05-22)\n* [#2323](https://github.com/gridstack/gridstack.js/issues/2323) module for Angular wrapper \n\n## 8.1.1 (2023-05-13)\n* fix: [#2314](https://github.com/gridstack/gridstack.js/issues/2314) fix issue with having min-height/width instead of height/width for gs-h|x=\"1\"\nalso further compressed CSS multi column rules (use `.gs-# > .grid-stack-item` instead of `.grid-stack-# > .grid-stack-item`)\n\n## 8.1.0 (2023-05-06)\n* break: remove `GridStackOptions.minWidth` obsolete since 5.1, use `oneColumnSize` instead\n* optimize: CSS files now even 25% smaller (after being halfed in 8.0.0) by removing `.grid-stack` prefix for anything already gs based, and 3 digit rounding.\n* fix: [#2275](https://github.com/gridstack/gridstack.js/issues/2275) `setupDragIn()` signature tweaks (HTMLElement | Document)\n* feat: [#2205](https://github.com/gridstack/gridstack.js/issues/2205) added `GridStackOptions.draggable.cancel` for list of selectors that should prevent item dragging\n\n## 8.0.1 (2023-04-29)\n* feat: [#2275](https://github.com/gridstack/gridstack.js/issues/2275) `setupDragIn()` now can take an array or elements (in addition to selector string) and optional parent root (for shadow DOM support)\n* fix: [#2234](https://github.com/gridstack/gridstack.js/issues/2234) `Utils.getElements('1')` (called by removeWidget() and others) now checks for digit 'selector' (becomes an id).\n* fix: [#2213](https://github.com/gridstack/gridstack.js/issues/2213) `destroy()` now removes event handlers too\n* feat: [#2292](https://github.com/gridstack/gridstack.js/issues/2292) ne nw resize handle\n* break: (meant to be in v8) removed `GridStackOptions.dragInOptions` since `GridStack.setupDragIn()`has it replaced since 4.0\n\n## 8.0.0 (2023-04-29)\n* package is now ES2020 (TS exported files), webpack all.js still umd (better than commonjs for browsers), still have es5/ files unchanged (for now)\n* optimize [#2243](https://github.com/gridstack/gridstack.js/issues/2243) removed `gs-min|max_w|h` attribute generated in CSS or written out as they are never used for rendering, only for initial load. This reduce our column/row CSS in half!\n* optimize: removed `gs-w='1'` and `gs-h='1'` dom attribute writing since we already have min-width/min-height set, no need to set more attributes.\n* optimize: remove `'ui-draggable'` and `'ui-resizable'` since wasn't used in CSS and we have the `-disabled` version when off (so we can use `not(xyz-disabled)`).\n* add: `GridStack.saveCB` global callback for each item during save so app can insert any custom data before serializing it. `save()` can now be passed optional callback\n* move: `GridStack.addRemoveCB` is now global instead of grid option. `load()` can still be passed different optional callback\n* fix: addGrid() to handle passing an existing initialized grid already\n* break: `GridStackOptions.subGrid` -> `GridStackOptions.subGridOpts`. We now have `GridStackWidget.subGridOpts` vs `GridStackNode.subGrid` (subclass) rather than try to merge the two at runtime since very different types...\n* tons of improvements for Angular wrapper.\n\n## 7.3.0 (2023-04-01)\n* feat [#2229](https://github.com/gridstack/gridstack.js/pull/2229) support nonce for CSP. Thank you [@jedwards1211](https://github.com/jedwards1211)\n* feat: support nested grids with Angular component demo. Thank you R. Blanken for supporting this.\n* fix [#2206](https://github.com/gridstack/gridstack.js/issues/2206) `load()` with collision fix\n* fix [#2232](https://github.com/gridstack/gridstack.js/issues/2232) `autoPosition` bug loading from DOM\n\n## 7.2.3 (2023-02-02)\n* fix `addWidget()` to handle passing just {el} which was needed for Angular HMTL template demo\n* add `opts.draggable.scroll` back to disable scrolling. Thank you [@VincentMolinie](https://github.com/VincentMolinie)\n\n## 7.2.2 (2023-01-16)\n* fix [#2171](https://github.com/gridstack/gridstack.js/issues/2171) `save()` nested grid has extra nested children & options\n* regression for fix #2110: nested grids lost their styles causing wrong rendering when dragging to create sub nesting\n\n## 7.2.1 (2023-01-14)\n* fix [#2162](https://github.com/gridstack/gridstack.js/pull/2162) removing item from a grid (into another) will now call `change` if anything was also modified during the remove\n* fix [#2110](https://github.com/gridstack/gridstack.js/issues/2110) custom `GridStackOptions.itemClass` now works when dragging from outside\n\n## 7.2.0 (2023-01-07)\n* fix [#1936](https://github.com/gridstack/gridstack.js/issues/1936) some styles left behind after a drag\n* remove [#1842](https://github.com/gridstack/gridstack.js/issues/1842) incorrect doc/partial code on widget resizeHandles\n* doc [#2033](https://github.com/gridstack/gridstack.js/issues/2033) `resizestop` is actually correct as we don't animate resize today\n* add - `init()`|`initAll()` will now load any listed children (what `addGrid()` already did)\n* add - `GridStackOptions.addRemoveCB` which is use by frameworks (eg Angular) to dynamically create their gridItem components instead of regular div with class\n\n## 7.1.2 (2022-12-29)\n* fix [#939](https://github.com/gridstack/gridstack.js/issues/2039) 'prototype' undefined error for dd-gridstack.js\n* add [#939](https://github.com/gridstack/gridstack.js/issues/2105) disable/enable are methods now recursive by default\n* add better `GridStackEventHandlerCallback` spelled out types\n* add We now have support for [Angular Component wrappers](https://github.com/gridstack/gridstack.js/tree/master/angular/) out of the box included in the build, with docs and demo! Need help to do that for React and Vue.\n\n## 7.1.1 (2022-11-13)\n* fix [#939](https://github.com/gridstack/gridstack.js/issues/939) editable elements focus (regression in v6). Thank you [@Gezdy](https://github.com/Gezdy)\n\n## 7.1.0 (2022-10-23)\n* back to MIT license in package.json\n* add `GridStackEngine.findEmptyPosition()`\n* fix [#2081](https://github.com/gridstack/gridstack.js/issues/2081) removeWidget() after it's gone from DOM\n* fix [#1985](https://github.com/gridstack/gridstack.js/issues/1985) addWidget() or DOM read in single column mode will not adjust to multi column mode\n* fix [#1975](https://github.com/gridstack/gridstack.js/issues/1975) oneColumnModeDomSort not respected when loading in 1 column\n\n## 7.0.1 (2022-10-14)\n* fix [#2073](https://github.com/gridstack/gridstack.js/issues/2073) SSR (server side rendering) isTouch issue (regression in v6)\n* fix - removing last item delete sub-grid that are not auto-generated (nested.html vs nested_advanced.html)\n\n## 7.0.0 (2022-10-09)\n* add [#1009](https://github.com/gridstack/gridstack.js/issues/1009) Create sub-grids on the fly,\nby dragging items completely over others (nest) vs partially (push) using new flag `GridStackOptions.subGridDynamic=true`.\nThank you [StephanP] for sponsoring it.<br>\nSee [advance Nested](https://github.com/gridstack/gridstack.js/blob/master/demo/nested_advanced.html)\n* add - ability to pause drag&drop collision until the user stops moving - see `DDDragOpt.pause` (used for creating nested grids on the fly based on gesture).\n* add [#1943](https://github.com/gridstack/gridstack.js/issues/1943) you can now drag sub-grids into other sub-grids\n\n## 6.0.3 (2022-10-08)\n* fix [#2055](https://github.com/gridstack/gridstack.js/issues/2055) maxRow=1 resize outside (broke in 6.0.1)\n* fix [#2054](https://github.com/gridstack/gridstack.js/issues/2054) Can't enter text in textarea/input (broke in v6)\n\n## 6.0.2 (2022-09-23)\n* fix [#2034](https://github.com/gridstack/gridstack.js/issues/2034) `removeWidget()` breaking resize handle feedback\n* fix [#2043](https://github.com/gridstack/gridstack.js/issues/2043) when swapping shapes in maxRow grid, make sure we still check for 50% coverage\n\n## 6.0.1 (2022-08-27)\n* fix `float(val)` to set on grid and engine, so save() will read it.\n* fix [#2018](https://github.com/gridstack/gridstack.js/issues/2018) mouseover and React different behavior\n* fix getting nested grid resize handles while dragging child\n\n## 6.0.0 (2022-08-21)\n* converted previous HTML5 `draggable=true` based code to simple Mouse Events and Touch mobile support for drag&Drop.\n* removed all jquery-ui related code, and D&D plugging as we only support native events now\n* `alwaysShowResizeHandle` now support `'mobile'` which is the default, making it much easier (see doc)\n* changed `commit()` to be `batchUpdate(false)` to make it easier to turn batch on/off. updated doc. old API remains for now\n\n## 5.1.1 (2022-06-16)\n* fix v5.1.0 regression [#1973](https://github.com/gridstack/gridstack.js/issues/1973) DnD Snap to Animation\n\n## 5.1.0 (2022-05-21)\n* add `GridStack.registerEngine()` to let user use their own custom layout engine subclass. Thank you [Thomas] for sponsoring it.\n* grid option `minWidth` is now `oneColumnSize` to make it clearer, but old field will still work (JS only) for a while\n* fix [#1966](https://github.com/gridstack/gridstack.js/issues/1966) restore animation when dragging items\n* updated jqueryui to latest v1.13.1\n\n## 5.0.0 (2022-01-10)\n* add [#992](https://github.com/gridstack/gridstack.js/issues/992) support dragging into and out of nested grids from parents! Thank you [@arclogos132](https://github.com/arclogos132) for sponsoring it.\n* add [#1910](https://github.com/gridstack/gridstack.js/pull/1910) new `column:'auto'` option to size nested grids to their parent grid item column count, keeping items the same size inside and outside. Thank you [@arclogos132](https://github.com/arclogos132) for also sponsoring it.\n* fix [#1902](https://github.com/gridstack/gridstack.js/pull/1902) nested.html: dragging between sub-grids show items clipped\n* fix [#1558](https://github.com/gridstack/gridstack.js/issues/1558) dragging between vertical grids causes too much growth, not follow mouse.\n* fix [#1912](https://github.com/gridstack/gridstack.js/pull/1912) no longer force rows for min-height\n* fix [#1888](https://github.com/gridstack/gridstack.js/issues/1888) locks up with nested grid when 'column' is set to 1\n\n## 4.4.1 (2021-12-24)\n* fix [#1901](https://github.com/gridstack/gridstack.js/pull/1901) error regression for #1785 when re-loading with fewer objects\n\n## 4.4.0 (2021-12-21)\n* add [#1887](https://github.com/gridstack/gridstack.js/pull/1887) support for IE (new es5 folder) by [@SmileLifeIven](https://github.com/SmileLifeIven)\n* fix [#1785](https://github.com/gridstack/gridstack.js/issue/1785) overlapping items when switching column() and making edits. Thank you [@radovanobal](https://github.com/radovanobal) for sponsoring it.\n* fix [#1890](https://github.com/gridstack/gridstack.js/issue/1890) unhandled exception when dragging fast between grids.\n\n## 4.3.1 (2021-10-18)\n* fix [#1868](https://github.com/gridstack/gridstack.js/issues/1868) prevent swap during resize\n* fix [#1849](https://github.com/gridstack/gridstack.js/issues/1849) [#1816](https://github.com/gridstack/gridstack.js/issues/1816) save highest resolution in 1 column mode\n* fix [#1855](https://github.com/gridstack/gridstack.js/issues/1855) resize when padding is large vs cellHeight\n\n## 4.3.0 (2021-10-15)\n* you can now swap items of different width if they are the same row/height. Thanks to [spektrummedia](http://spektrummedia.com) for sponsoring it.\n* fix [#1860](https://github.com/gridstack/gridstack.js/issues/1860) nested grid save inf loop fix\n* use latest `dart-sass`, updated comments\n\n## 4.2.7 (2021-9-12)\n\n* fix [#1817](https://github.com/gridstack/gridstack.js/issues/1817) Enable passing of DragEvent to gridstack dropped event. Thanks [@onepartsam](https://github.com/onepartsam)\n* fix [#1835](https://github.com/gridstack/gridstack.js/issues/1835) Layout incorrectly restored when node has a minimum width. Thanks [@hssm](https://github.com/hssm)\n* fix [#1794](https://github.com/gridstack/gridstack.js/issues/1794) addGrid() does not recognize rem cellHeightUnit\n\n## 4.2.6 (2021-7-11)\n\n* fix [#1784](https://github.com/gridstack/gridstack.js/issues/1784) `removable:true` working by itself (without needing `acceptWidgets:true`)\n* fix [#1791](https://github.com/gridstack/gridstack.js/pull/1791) removed drag flicker and scroll issue. Thanks [@nelsieborja](https://github.com/nelsieborja)\n* fix [#1795](https://github.com/gridstack/gridstack.js/issues/1795) `save(false)` will no longer have `.content` field (removed existing one if present)\n* fix [#1782](https://github.com/gridstack/gridstack.js/issues/1782) `save(false, false)` now correctly saves nested grids\n* fix [#1793](https://github.com/gridstack/gridstack.js/issues/1793) `save(false, true)` followed by enable() throws error. we now have new `Utils.cloneDeep()`\n\n## 4.2.5 (2021-5-31)\n\n* fix for website with JQ `droppable('destroy')` giving error\n\n## 4.2.4 (2021-5-29)\n\n* fix [#1760](https://github.com/gridstack/gridstack.js/issues/1760) `removable:true` working again (broke in 4.x)\n* fix [#1761](https://github.com/gridstack/gridstack.js/issues/1761) `staticGrid(false)` will now enable drag in behavior (if set)\n* fix [#1767](https://github.com/gridstack/gridstack.js/issues/1767) `locked` item can be user moved/resized again, just not pushed by other nodes (broke in 1.1.1)\n* fix [#1764](https://github.com/gridstack/gridstack.js/issues/1764) `destroy(false)` can now re-init properly (doesn't force static grid)\n\n## 4.2.3 (2021-5-8)\n\n- `Utils.getScrollParent()` -> `getScrollElement()` rename\n- fix [#1745](https://github.com/gridstack/gridstack.js/issues/1745) digression on scrolling in v4.2.1. Thanks [@Manfred-on-github](https://github.com/Manfred-on-github) for fixing your prev change.\n\n## 4.2.2 (2021-4-23)\n\n- fix [#1684](https://github.com/gridstack/gridstack.js/issues/1684) [#1550](https://github.com/gridstack/gridstack.js/issues/1550) mac Safari H5 draggable broken in 4.0.1. Thanks [@wurambo](https://github.com/wurambo)\n- fix [#1562](https://github.com/gridstack/gridstack.js/issues/1562) mac Safari page scroll fix\n\n## 4.2.1 (2021-4-18)\n\n- fix [#1700](https://github.com/gridstack/gridstack.js/issues/1700) JQ nested grid drag fix broken in 4.0.3 (but much older underlying issue)\n- fix [#1678](https://github.com/gridstack/gridstack.js/issues/1678) item gs-x:0 not animating fix\n- fix [#1727](https://github.com/gridstack/gridstack.js/pull/1727) resize-scroll issue when grid is not at top of page. Thanks [@Manfred-on-github](https://github.com/Manfred-on-github)\n- fix [#1728](https://github.com/gridstack/gridstack.js/issues/1728) fix sizing from top/left sides\n\n## 4.2.0 (2021-4-11)\n\n- fix [#1704](https://github.com/gridstack/gridstack.js/issues/1704) scrollbar fix broken in 4.x\n- fix [#1655](https://github.com/gridstack/gridstack.js/issues/1655) `addWidget()` while in 1 column now remembers original wanted width\n- add [#1727](https://github.com/gridstack/gridstack.js/issues/1727) `addWidget()` now supports nested grids like init/addGrid() does.\n\n## 4.1.0 (2021-4-7)\n\n- fix [#219](https://github.com/gridstack/gridstack.js/issues/219) **fixing another 6 years old request** we now automatically insert extra rows\nwhen dragging an item at the bottom below others to make it easier to insert below.\n- fix [#1687](https://github.com/gridstack/gridstack.js/issues/1687) more fix for drag between 2 grids with `row / maxRow` broken in 4.x\n- fix export symbols .d.ts for `gridstack-h5.js | gridstack-jq.js | gridstack-static.js`\n- fix [#1709](https://github.com/gridstack/gridstack.js/issues/1709) correct info for using JQ version and ES6 (tested in Angular app)\n\n## 4.0.3 (2021-3-28)\n\n- fix [#1693](https://github.com/gridstack/gridstack.js/issues/1693) `load` after `init()` broken in 4.x\n- fix [#1687](https://github.com/gridstack/gridstack.js/issues/1687) drag between 2 grids with `row / maxRow` broken in 4.x\n- fix [#1676](https://github.com/gridstack/gridstack.js/issues/1676) drag edge case in/out single grid without acceptWidgets fix broken in 4.x\n\n## 4.0.2 (2021-3-27)\n\n- fix [#1679](https://github.com/gridstack/gridstack.js/issues/1679) `Resizable: {handles:'w/sw'}` broken in 4.x\n- fix [#1658](https://github.com/gridstack/gridstack.js/issues/1658) `enableMove(T/F)` not working correctly\n- fix `helper: myFunction` now working for H5 case for `dragInOptions` & `setupDragIn()` broken in 3.x\n- fix prevent `addGrid()` from creating nested div grid if container already is a '.grid-stack' div\n\n## 4.0.1 (2021-3-20)\n\n- fix [#1669](https://github.com/gridstack/gridstack.js/issues/1669) JQ resize broken in 4.x\n- fix [#1661](https://github.com/gridstack/gridstack.js/issues/1661) serialization of nested grid\n\n## 4.0.0 (2021-3-19)\n\n- fix [#149](https://github.com/gridstack/gridstack.js/issues/149) [#1094](https://github.com/gridstack/gridstack.js/issues/1094) [#1605](https://github.com/gridstack/gridstack.js/issues/1605) [#1534](https://github.com/gridstack/gridstack.js/issues/1534) re-write of the **collision code - fixing 6 years old most requested request**\n1. you can now swap items of the same size (vertical/horizontal) when grid is full, and is the default in `float:false` (top gravity) as it feels more natural. Could add Alt key for swap vs push behavior later.\n2. Dragging up and down now behave the same (used to require push WAY down past to swap/append). Also much more efficient collision code.\n3. handle mid point of dragged over items (>50%) rather than just a new row/column and check for the most covered item when multiple collide.\n\n- fix [#393](https://github.com/gridstack/gridstack.js/issues/393) [#1612](https://github.com/gridstack/gridstack.js/issues/1612) [#1578](https://github.com/gridstack/gridstack.js/issues/1578) re-write of the **drag in/out code - fixing 5 years old bug**\n1. we now remove item when cursor leaves (`acceptWidgets` case using `dropout` event) or shape is outside (re-using same method) and re-insert on cursor enter (since we only get `dropover` event). Should **not be possible to have 2 placeholders** which confuses the grids.\n2. major re-write and cleanup of the drag in/out. Vars have been renamed and fully documented as I couldn't understand the legacy buggy code.\n3. removed any over trash delay feedback as I don't see the point and could introduce race conditions.\n\n- fix [1617](https://github.com/gridstack/gridstack.js/issues/1617) FireFox DOM order issue. Thanks [@marcel-necker](https://github.com/marcel-necker)\n- fix changing column # `column(n)` now resizes `cellHeight:'auto'` to keep square\n- add [1616](https://github.com/gridstack/gridstack.js/pull/1616) `drag | resize` events while dragging. Thanks [@MrCorba](https://github.com/MrCorba)\n- add [1637](https://github.com/gridstack/gridstack.js/issues/1637) `GridStack.setupDragIn()` so user can update external draggable after the grid has been created\n\n## 3.3.0 (2021-2-2)\n\n- big re-write on how `cellHeight()` works. you can now call it at any time (not just grid init options) including switching to 'auto' or other modes on the fly.\n- fix `cellHeight:auto` now keeps cell square as window resizes (regressing from 2.x TS conversion). `Utils.throttle()` works better too (guaranteed to be called last event)\n- new `cellHeight:initial` which makes the cell squares initially, but doesn't change as windows resizes (better performance)\n- new grid option `cellHeightThrottle` (100ms) to control throttle of auto sizing triggers\n- fix [1600](https://github.com/gridstack/gridstack.js/issues/1600) height too small with `cellHeight:auto` loading in 1 column. Now detect we load at 1 column and size accordingly (default 'auto' could make big 700x700 cells, so explicit px might still be wanted)\n- fix [1538](https://github.com/gridstack/gridstack.js/issues/1538) loading nested into small size and sizing back up\n- fix [1604](https://github.com/gridstack/gridstack.js/issues/1604) nested grid resizing fix\n- fix [1599](https://github.com/gridstack/gridstack.js/issues/1599) resize from left side can move item right\n\n## 3.2.0 (2021-1-25)\n\n- fix [1413](https://github.com/gridstack/gridstack.js/issues/1413) website & lib works on mobile. We now compile the latest v1.0.8 `jquery.ui.touch-punch`\ninto the JQ version (only 2k) so mobile devices (android, iphone, ipad, ms surface, etc...) are supported out of the box.\nHTML5 version will require re-write to plain `mousemove` & mobile `touchmove` instead of drag events in a future release.\n- small optimizations (create placeholder content on the fly, moved more DD code into draggable class)\n\n## 3.1.5 (2021-1-23)\n\n- fix [1572](https://github.com/gridstack/gridstack.js/issues/1572) `column: N` option now sets CSS class\n- fix [1571](https://github.com/gridstack/gridstack.js/issues/1571) don't allow drop when grid is full\n- fix [1570](https://github.com/gridstack/gridstack.js/issues/1570) easier to drag out/in from below\n- fix [1579](https://github.com/gridstack/gridstack.js/issues/1579) `cellHeight()` not updating CSS correctly\n- fix [1581](https://github.com/gridstack/gridstack.js/issues/1581) H5 draggable by actual div handle rather than entire item (let content respond to drag as well)\n\n## 3.1.4 (2021-1-11)\n\n- fix [1557](https://github.com/gridstack/gridstack.js/issues/1557) fix no-drop cursor on windows when dragging within a default grid (no external drag in)\n- fix [1541](https://github.com/gridstack/gridstack.js/issues/1541) fix Safari H5 delay when dropping items\n\n## 3.1.3 (2021-1-2)\n\n- fix [1540](https://github.com/gridstack/gridstack.js/issues/1540) Safari H5 drag&drop fix\n- fix [1535](https://github.com/gridstack/gridstack.js/issues/1535) use batchUpdate() around grid init to make sure gs-y attributes are respected.\n- fix [1545](https://github.com/gridstack/gridstack.js/issues/1545) `disableMove()` correctly prevents drag later (remove events and draggable attribute)\n- fix [1546](https://github.com/gridstack/gridstack.js/issues/1546) resize no longer delayed, which caused race conditions errors\n- fix [1001](https://github.com/gridstack/gridstack.js/issues/1001) resizing near bottom/top needs to auto-scroll/. thanks [@hbcarlos](https://github.com/hbcarlos)!\n\n## 3.1.2 (2020-12-7)\n\n- fix [1419](https://github.com/gridstack/gridstack.js/issues/1419) dragging into a fixed row grid works better (check if it will fit, else try to append, else won't insert)\n-- **possible BREAK** (unlikely you use engine directly)\n* engine constructor takes Options struct rather than spelling arguments (easier to extend/use)\n* `canBePlacedWithRespectToHeight()` -> `willItFit()` like grid method\n\n- fix [1330](https://github.com/gridstack/gridstack.js/issues/1330) `maxW` does not work as intended with resizable handle `\"w\"`\n- fix [1472](https://github.com/gridstack/gridstack.js/issues/1472) support all options for new dragged in widgets (read all `gs-xyz` attributes)\n- fix [1511](https://github.com/gridstack/gridstack.js/issues/1511) dragging any grid item content works\n- fix [1438](https://github.com/gridstack/gridstack.js/issues/1438) web-component fixes & grid with 0 size initially.\n\n## 3.1.0 (2020-12-4)\n\n- add new `addGrid(parent, opts)` to create a grid and load children instead of `init() + load()`, which is used by `load()` to supports nested grids creation.\nsee [nested.html](https://github.com/gridstack/gridstack.js/tree/master/demo/nested.html) demo.\n- `save()` will now work on nested grids, recursively saving info. added flag to also allow saving the current grid options + children\n(needed for nested grids) so you can now call new `adddGrid()` to re-create everything from JSON.\n- fix [1505](https://github.com/gridstack/gridstack.js/issues/1505) don't call `movable()`/`resizable()` on locked items error. thanks [@infime](https://github.com/infime)\n- fix [1517](https://github.com/gridstack/gridstack.js/pull/1517) force typescript 3.6 as 3.7 has breaking change\n\n## 3.0.0 (2020-11-29)\n\n- the big news is we finally have a native HTML5 drag&drop plugin (zero jquery)! Huge thanks to [@rhlin](https://github.com/rhlin) for creating this in stealth mode. Read all about it in main doc.\n- we now have a React example, in addition to Vue - Angular is next!. thanks [@eloparco](https://github.com/eloparco)\n- fix placeholder not having custom `GridStackOptions.itemClass`. thanks [@pablosichert](https://github.com/pablosichert)\n- fix [1484](https://github.com/gridstack/gridstack.js/issues/1484) dragging between 2 grids and back (regression in 2.0.1) \n- fix [1471](https://github.com/gridstack/gridstack.js/issues/1471) `load()` into 1 column mode doesn't resize back to 12 correctly\n- fix [1235](https://github.com/gridstack/gridstack.js/issues/1235) `update(el, opts)` re-write to take all `GridStackWidget` options (not just x,y,width,height) and do everything efficiently.\nHiding `locked()`, `move()`, `resize()`, `minWidth()`, etc... as they just simply call update() which does all the constrain now as well!\n- del `ddPlugin` grid option as we only have one drag&drop plugin at runtime, which is defined by the include you use (HTML5 vs jquery vs none)\n- change attribute `data-gs-min-width` is now `gs-min-w`. We removed 'data-' from all attributes, and shorten 'width|height' to just 'w|h' to require less typing and more efficient (2k saved in .js alone!) [1491](https://github.com/gridstack/gridstack.js/pull/1491) [1492](https://github.com/gridstack/gridstack.js/pull/1492)\n- also `GridStackWidget` used in most API `width|height|minWidth|minHeight|maxWidth|maxHeight` are now shorter `w|h|minW|minH|maxW|maxH` as well [1493](https://github.com/gridstack/gridstack.js/pull/1493)\n- **** see [migrating to v3](https://github.com/gridstack/gridstack.js#migrating-to-v3) ****\n\n## 2.2.0 (2020-11-7)\n\n- add `margin` option now support multi values CSS format `'5px 10px 0 20px'` or `'5em 10em'`\n- add `data-gs-static-grid` attribute\n- fix [1435](https://github.com/gridstack/gridstack.js/issues/1435) `class=\"ui-draggable-disabled ui-resizable-disabled\"` have been added back to static grid items, so existing CSS rule to style continue working \n- fix [1439](https://github.com/gridstack/gridstack.js/pull/1439) getting DOM element by id with number works (api that uses `GridStackElement` handle more string formats)\n- fix [1442](https://github.com/gridstack/gridstack.js/pull/1442) setting `marginTop` (or any 4 sides) to cause resize to break. Thanks [@deadivan](https://github.com/deadivan) for suggested fix.\n\n## 2.1.0 (2020-10-28)\n\n- fix grid `static: true` to no longer add any drag&drop (even disabled) which should speed things up, and `setStatic(T/F)` will now correctly add it back/delete for items that need it only. \nAlso fixed JQ draggable warning if not initialized first [858](https://github.com/gridstack/gridstack.js/issues/858)\n- add `addWidget(opt)` now handles just passing a `GridStackWidget` which creates the default divs, simplifying your code. Old API still supported.\n- add `save(saveContent = true)` now lets you optionally save the HTML content in the node property, with load() restoring it [1418](https://github.com/gridstack/gridstack.js/issues/1418)\n- add `GridStackWidget.content` now lets you add any HTML content when calling `load()/save()` or `addWidget()` [1418](https://github.com/gridstack/gridstack.js/issues/1418)\n- add `ColumnOptions` to `column(n, options)` for multiple re-layout options, including 'none' that will preserve the x and width, until out of bound/overlap [1338](https://github.com/gridstack/gridstack.js/issues/1338)\nincluding a custom function for you to create the new layout [1332](https://github.com/gridstack/gridstack.js/issues/1332)\n\n## 2.0.2 (2020-10-05)\n\n- fix `animate` to not re-create CSS style each time (should be faster too) and made it default now since so much nicer. pass `{animate: false}` grid options if you want instant again [937](https://github.com/gridstack/gridstack.js/issues/937)\n- fix `resizable: { handles: ...}` forcing `alwaysShowResizeHandle` behavior [1373](https://github.com/gridstack/gridstack.js/issues/1373)\n\n## 2.0.1 (2020-09-26)\n\n- fix `minWidth()`, `minHeight()`, `maxHeight()` to set node value as well [1359](https://github.com/gridstack/gridstack.js/issues/1359)\n- fix `GridStackOptions` spelling [1359](https://github.com/gridstack/gridstack.js/issues/1359)\n- fix remove window resize event when `grid.destroy()` [1369](https://github.com/gridstack/gridstack.js/issues/1369)\n- fix nested grid resize [1361](https://github.com/gridstack/gridstack.js/issues/1361)\n- fix resize with `cellHeight` '6rem' '6em' not working [1356](https://github.com/gridstack/gridstack.js/issues/1356)\n- fix preserve attributes (min/max/id/etc...) when dragging between grids [1367](https://github.com/gridstack/gridstack.js/issues/1367)\n- fix 2 drop shadows when dragging between grids [393](https://github.com/gridstack/gridstack.js/issues/393)\n\n## 2.0.0 (2020-09-07)\n\n- re-write to native Typescript, removing all JQuery from main code and API (drag&drop plugin still using jqueryui for now)\n- add `getGridItems()` to return list of HTML grid items\n- add `{dragIn | dragInOptions}` grid attributes to handle external drag&drop items\n- add `save()` and `load()` to serialize grids from JSON, saving all attributes (not just w,h,x,y) [1286](https://github.com/gridstack/gridstack.js/issues/1286)\n- add `margin` to replace `verticalMargin` which affects both dimensions in code, rather than one in code the other in CSS.\nYou can now have perfect square cells (default) [723](https://github.com/gridstack/gridstack.js/issues/723)\n- fix [1299](https://github.com/gridstack/gridstack.js/pull/1299) many columns round-off error\n- fix [1102](https://github.com/gridstack/gridstack.js/issues/1102) loose functionality when they are moved to a new grid\n- add optional params to `removeWidget()` to have quiet mode (no callbacks)\n- drop support for IE11 due to more compact ES6 output and newer TS code\n\n## 1.2.1 (2020-09-04)\n\n- fix [1341](https://github.com/gridstack/gridstack.js/pull/1341) Enable the UMD behavior for bundlers compatibility\n\n## 1.2.0 (2020-08-01)\n\n- fix [1311](https://github.com/gridstack/gridstack.js/issues/1311) domAttr is not defined\n- adds `styleInHead` option to allow for selecting older behavior (adding STYLE element to HEAD element instead of parentNode)\n- update jquery to v3.5.1\n\n## 1.1.2 (2020-05-17)\n\n- fix [1229](https://github.com/gridstack/gridstack.js/issues/1229) `staticGrid` no longer disable oneColumnMode\n- fix [1195](https://github.com/gridstack/gridstack.js/issues/1195) options broken with ember hash helper - thanks [@btecu](https://github.com/btecu)\n- fix [1250](https://github.com/gridstack/gridstack.js/issues/1250) don't remove item from another grid\n- fix [1261](https://github.com/gridstack/gridstack.js/issues/1261) `init()` clones passed options so second doesn't affect first one\n- fix [1276](https://github.com/gridstack/gridstack.js/issues/1276) `addWidget()` ignores data attributes\n\n## 1.1.1 (2020-03-17)\n\n- fix [1187](https://github.com/gridstack/gridstack.js/issues/1187) IE support for `CustomEvent` polyfill - thanks [@phil-blais](https://github.com/phil-blais)\n- fix [1204](https://github.com/gridstack/gridstack.js/issues/1204) destroy drag&drop when removing node(s) instead of just disabling it.\n- fix [1181](https://github.com/gridstack/gridstack.js/issues/1181) Locked widgets are still moveable by other widgets.\n- fix [1217](https://github.com/gridstack/gridstack.js/issues/1217) If I set cellHeight to some vh, only first grid will take vh, rest will use px\n- include SASS source files to npm package again [1193](https://github.com/gridstack/gridstack.js/pull/1193)\n\n## 1.1.0 (2020-02-29)\n\n- add `minRow` and `row` grid options (which set minRow=maxRow=N) [1172](https://github.com/gridstack/gridstack.js/issues/1172) - thanks [@RadoiAndrei](https://github.com/RadoiAndrei)\n- fix [1166](https://github.com/gridstack/gridstack.js/issues/1166) resize not taking margin height into account - thanks [@awjae](https://github.com/awjae)\n- fix [1155](https://github.com/gridstack/gridstack.js/issues/1155) `maxRow` now limit initial item placement if out of bound, preventing broken drag behavior\n- fix [1171](https://github.com/gridstack/gridstack.js/issues/1171) added event support to call `grid.on('added removed change', callback)` again even with native events.\n\n## v1.0.0 (2020-02-23)\n\n- **breaking**: [(1084)](https://github.com/gridstack/gridstack.js/issues/1084) jquery was removed from the API and dependencies (initialize differently, and methods take/return `GridStack` or `HTMLElement` instead of `JQuery`), so your code will need to change. \nSee [Migrating to v1.0.0](https://github.com/gridstack/gridstack.js/tree/master/README.md#migrating-to-v100)\n- `setColumn(N)` is now `column(N)` (matches other set/get methods) and `getColumn()` to get current column number\n- add `grid.on(eventName, callback)` / `grid.off(eventName)` to hide native JQ events mix\n- add `grid.getRow()` to get the current grid row number\n\n## v0.6.4 (2020-02-17)\n\n- fix [#540](https://github.com/gridstack/gridstack.js/issues/540) WebComponent support: CSS file now insert before grid instead of 'head'\n- fix [#1143](https://github.com/gridstack/gridstack.js/issues/1143) nested grids with different `acceptWidgets` class\n- fix [#1142](https://github.com/gridstack/gridstack.js/issues/1142) add/remove widget will also trigger change events when it should.\n- optimized `change` callback to save original x,y,w,h values and only call those that changed [1148](https://github.com/gridstack/gridstack.js/pull/1148)\n- delete `bower` since [dead](https://snyk.io/blog/bower-is-dead) for a while now\n\n## v0.6.3 (2020-02-05)\n\n- fix [#1132](https://github.com/gridstack/gridstack.js/issues/1132) oneColumnMode missing CSS to do layout\n- del `oneColumnModeClass` / `.grid-stack-one-column-mode` and associated code. If you depended on this, use class `.grid-stack-1` instead since it is 1 column layout anyway [1134](https://github.com/gridstack/gridstack.js/pull/1134)\n\n## v0.6.2 (2020-02-03)\n\n- add `oneColumnModeDomSort` true|false to let you specify a custom layout (use dom order instead of x,y) for oneColumnMode `column(1)` [#713](https://github.com/gridstack/gridstack.js/issues/713)\n- fix oneColumnMode to only restore if we auto went to it as window sizes up [#1125](https://github.com/gridstack/gridstack.js/pull/1125)\n- editing in 1 column (or few columns) does a better job updating higher layout (track before and after and move items accordingly). \nTracking item swap would be even better still. [#1127](https://github.com/gridstack/gridstack.js/pull/1127)\n\n## v0.6.1 (2020-02-02)\n\n- fix [#37](https://github.com/gridstack/gridstack.js/issues/37) oneColumnMode (<768px by default) now simply calls `column(1)` and remembers prev columns (so we can restore). This gives\nus full resize/re-order of items capabilities rather than a locked CSS only layout (see prev rev changes). [#1120](https://github.com/gridstack/gridstack.js/pull/1120)\n- fix [responsive.html](https://gridstackjs.com/demo/responsive.html) demo [#1121](https://github.com/gridstack/gridstack.js/pull/1121)\n\n## v0.6.0 (2019-12-24)\n\n- add `float(val)` to set/get the grid float mode, which will relayout [#1088](https://github.com/gridstack/gridstack.js/pull/1088)\n- add `compact()` to reclaim any empty space and relayout grid items [#1101](https://github.com/gridstack/gridstack.js/pull/1101)\n- add `options.dragOut` to let user drag nested grid items out of a parent or not (default false)\nand jQuery UI `draggable.containment` can now be specified in options. You can now drag&drop between 2 nested grids [#1105](https://github.com/gridstack/gridstack.js/pull/1105)\n- add `%` as a valid unit for height [#1093](https://github.com/gridstack/gridstack.js/pull/1093). thank you \n[@trevisanweb](https://github.com/trevisanweb) [@aureality](https://github.com/aureality)\n[@ZoolWay](https://github.com/ZoolWay)\n- fix callbacks to get either `added, removed, change` or combination if adding a node require also to change its (x,y) for example.\nAlso you can now call `batchUpdate()` before calling a bunch of `addWidget()` and get a single event callback (more efficient).\n[#1096](https://github.com/gridstack/gridstack.js/pull/1096)\n- `removeAll()` is now much faster (no relayout) and calls `removed` event just once with a list [#1097](https://github.com/gridstack/gridstack.js/pull/1097)\n- `column()` complete re-write and is no longer \"Experimental\". We now do a reasonable job at sizing/position the widgets (especially 1 column) and\nalso now cache each column layout so you can go back to say 12 column and not loose original layout. [#1098](https://github.com/gridstack/gridstack.js/pull/1098)\n- fix `addWidget(el)` (no data) would not render item at correct location, and overlap item at (0,0) [#1098](https://github.com/gridstack/gridstack.js/pull/1098)\n- you can now pre-define size of dragable elements from a sidebar using standard `data-gs-width` and `data-gs-height` - fix \n[#413](https://github.com/gridstack/gridstack.js/issues/413), [#914](https://github.com/gridstack/gridstack.js/issues/914), [#918](https://github.com/gridstack/gridstack.js/issues/918), \n[#922](https://github.com/gridstack/gridstack.js/issues/922), [#933](https://github.com/gridstack/gridstack.js/issues/933) \nthanks [@ermcgrat](https://github.com/ermcgrat) and others for pointing out code issue.\n\n## v0.5.5 (2019-11-27)\n\n- min files include rev number/license [#1075](https://github.com/gridstack/gridstack.js/pull/1075)\n- npm package fix to exclude more temporary content [#1078](https://github.com/gridstack/gridstack.js/pull/1078)\n- removed `jquery-ui/*` requirements from AMD packing in `gridstack.jQueryUI.js` as it was causing App compile missing errors now that we include a subset of jquery-ui\n\n## v0.5.4 (2019-11-26)\n\n- fix for griditems with x=0 placement wrong order (regression by [#1017](https://github.com/gridstack/gridstack.js/issues/10510174)) ([#1054](https://github.com/gridstack/gridstack.js/issues/1054)).\n- fix `cellHeight(val)` not working due to style change (regression by [#937](https://github.com/gridstack/gridstack.js/issues/937)) ([#1068](https://github.com/gridstack/gridstack.js/issues/1068)).\n- add `gridstack-poly.js` for IE and older browsers, removed `core-js` lib from samples (<1k vs 85k), and all IE8 mentions ([#1061](https://github.com/gridstack/gridstack.js/pull/1061)).\n- add `jquery-ui.js` (and min.js) as minimal subset we need (55k vs 248k), which is now part of `gridstack-h5.js`. Include individual parts if you need your own lib instead of all.js\n([#1064](https://github.com/gridstack/gridstack.js/pull/1064)).\n- changed jquery dependency to lowest we can use (>=1.8) ([#629](https://github.com/gridstack/gridstack.js/issues/629)).\n- add advance demo from web site ([#1073](https://github.com/gridstack/gridstack.js/pull/1073)).\n\n## v0.5.3 (2019-11-20)\n\n- grid options `width` is now `column`, `height` now `maxRow`, and `setGridWidth()` now `column()` to match what they are. Old names are still supported (console warnings). Various fixes for custom # of column and re-wrote entire doc section ([#1053](https://github.com/gridstack/gridstack.js/issues/1053)).\n- fix widgets not animating when `animate: true` is used. on every move, styles were recreated-fix should slightly improve gridstack.js speed ([#937](https://github.com/gridstack/gridstack.js/issues/937)).\n- fix moving widgets when having multiple grids. jquery-ui workaround ([#1043](https://github.com/gridstack/gridstack.js/issues/1043)).\n- switch to eslint ([#763](https://github.com/gridstack/gridstack.js/issues/763)) thanks [@rwstoneback](https://github.com/rwstoneback).\n- fix null values `addWidget()` options ([#1042](https://github.com/gridstack/gridstack.js/issues/1042)).\n\n## v0.5.2 (2019-11-13)\n\n- fix undefined `x,y` position messes up grid ([#1017](https://github.com/gridstack/gridstack.js/issues/1017)).\n- changed code to 2 spaces.\n- fix minHeight during `onStartMoving()` ([#999](https://github.com/gridstack/gridstack.js/issues/999)).\n- add `gridstack.d.ts` TypeScript definition file now included - no need to include `@types/gridstack`, easier to update ([#1036](https://github.com/gridstack/gridstack.js/pull/1036)).\n- add `addWidget(el, options)` to pass object so you don't have to spell 10 params. ([#907](https://github.com/gridstack/gridstack.js/issues/907)).\n\n## v0.5.1 (2019-11-07)\n\n- reduced npm package size from 672k to 324k (drop demo, src and extra files)\n\n## v0.5.0 (2019-11-06)\n\n- emit `dropped` event when a widget is dropped from one grid into another ([#823](https://github.com/gridstack/gridstack.js/issues/823)).\n- don't throw error if no bounding scroll element is found ([#891](https://github.com/gridstack/gridstack.js/issues/891)).\n- don't push locked widgets even if they are at the top of the grid ([#882](https://github.com/gridstack/gridstack.js/issues/882)).\n- RequireJS and CommonJS now export on the `exports` module fix ([#643](https://github.com/gridstack/gridstack.js/issues/643)).\n- automatically scroll page when widget is moving beyond viewport ([#827](https://github.com/gridstack/gridstack.js/issues/827)).\n- removed lodash dependencies ([#693](https://github.com/gridstack/gridstack.js/issues/693)).\n- don't overwrite globals jQuery when in a modular environment ([#974](https://github.com/gridstack/gridstack.js/pull/974)).\n- removed z-index from `.grid-stack-item-content` causing child modal dialog clipping ([#984](https://github.com/gridstack/gridstack.js/pull/984)).\n- convert project to use yarn ([#983](https://github.com/gridstack/gridstack.js/pull/983)).\n\n## v0.4.0 (2018-05-11)\n\n- widgets can have their own resize handles. Use `data-gs-resize-handles` element attribute to use. For example, `data-gs-resize-handles=\"e,w\"` will make the particular widget only resize west and east. ([#494](https://github.com/gridstack/gridstack.js/issues/494)).\n- enable sidebar items to be duplicated properly. Pass `helper: 'clone'` in `draggable` options. ([#661](https://github.com/gridstack/gridstack.js/issues/661), [#396](https://github.com/gridstack/gridstack.js/issues/396), [#499](https://github.com/gridstack/gridstack.js/issues/499)).\n- fix `staticGrid` grid option ([#743](https://github.com/gridstack/gridstack.js/issues/743))\n- preserve inline styles when moving/cloning items (thanks [@silverwind](https://github.com/silverwind))\n- fix bug causing heights not to get set ([#744](https://github.com/gridstack/gridstack.js/issues/744))\n- allow grid to have min-height, fixes ([#628](https://github.com/gridstack/gridstack.js/issues/628)) thanks [@adumesny](https://github.com/adumesny)\n- widget x and y are now ints (thanks [@DonnchaC](https://github.com/donnchac))\n- allow all droppable options (thanks [@vigor-vlad](https://github.com/vigor-vlad))\n- properly track mouse position in `getCellFromPixel` (thanks [@aletorrado](https://github.com/aletorrado))\n- remove instance of `!important` (thanks [@krilllind](https://github.com/krilllind))\n- scroll when moving widget up or down out of viewport ([#827](https://github.com/gridstack/gridstack.js/issues/827))\n\n## v0.3.0 (2017-04-21)\n\n- remove placeholder when dragging widget below grid (already worked when dragging left, above, and to the right of grid).\n- prevent extra checks for removing widget when dragging off grid.\n- trigger `added` when a widget is added via dropping from one grid to another.\n- trigger `removed` when a widget is removed via dropping from one grid to another.\n- trigger `removed` when a widget is removed via dropping on a removable zone ([#607](https://github.com/gridstack/gridstack.js/issues/607) and [#550](https://github.com/gridstack/gridstack.js/issues/550)).\n- trigger custom event for `resizestop` called `gsresizestop` ([#577](https://github.com/gridstack/gridstack.js/issues/577) and [#398](https://github.com/gridstack/gridstack.js/issues/398)).\n- prevent dragging/resizing in `oneColumnMode` ([#593](https://github.com/gridstack/gridstack.js/issues/593)).\n- add `oneColumnModeClass` option to grid.\n- remove 768px CSS styles, moved to grid-stack-one-column-mode class.\n- add max-width override on grid-stck-one-column-mode ([#462](https://github.com/gridstack/gridstack.js/issues/462)).\n- add internal function`isNodeChangedPosition`, minor optimization to move/drag.\n- drag'n'drop plugin system. Move jQuery UI dependencies to separate plugin file.\n\n## v0.2.6 (2016-08-17)\n\n- update requirements to the latest versions of jQuery (v3.1.0+) and jquery-ui (v1.12.0+).\n- fix jQuery `size()` ([#486](https://github.com/gridstack/gridstack.js/issues/486)).\n- update `destroy([removeDOM])` call ([#422](https://github.com/gridstack/gridstack.js/issues/422)).\n- don't mutate options when calling `draggable` and `resizable`. ([#505](https://github.com/gridstack/gridstack.js/issues/505)).\n- update _notify to allow detach ([#411](https://github.com/gridstack/gridstack.js/issues/411)).\n- fix code that checks for jquery-ui ([#481](https://github.com/gridstack/gridstack.js/issues/481)).\n- fix `cellWidth` calculation on empty grid\n\n## v0.2.5 (2016-03-02)\n\n- update names to respect js naming convention.\n- `cellHeight` and `margin` can now be string (e.g. '3em', '20px') (Thanks to @jlowcs).\n- add `maxWidth`/`maxHeight` methods.\n- add `enableMove`/`enableResize` methods.\n- fix window resize issue [#331](https://github.com/gridstack/gridstack.js/issues/331)).\n- add options `disableDrag` and `disableResize`.\n- fix `batchUpdate`/`commit` (Thank to @radiolips)\n- remove dependency of FontAwesome\n- RTL support\n- `'auto'` value for `cellHeight` option\n- fix `setStatic` method\n- add `setAnimation` method to API\n- add `column` method ([#227](https://github.com/gridstack/gridstack.js/issues/227))\n- add `removable`/`removeTimeout` *(experimental)*\n- add `removeDOM` parameter to `destroy` method ([#216](https://github.com/gridstack/gridstack.js/issues/216)) (thanks @jhpedemonte)\n- add `useOffset` parameter to `getCellFromPixel` method ([#237](https://github.com/gridstack/gridstack.js/issues/237))\n- add `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `id` parameters to `addWidget` ([#188](https://github.com/gridstack/gridstack.js/issues/188))\n- add `added` and `removed` events for when a widget is added or removed, respectively. ([#54](https://github.com/gridstack/gridstack.js/issues/54))\n- add `acceptWidgets` parameter. Widgets can now be draggable between grids or from outside *(experimental)*\n\n## v0.2.4 (2016-02-15)\n\n- fix closure compiler/linter warnings\n- add `staticGrid` option.\n- add `minWidth`/`minHeight` methods (Thanks to @cvillemure)\n- add `destroy` method (Thanks to @zspitzer)\n- add `placeholderText` option (Thanks to @slauyama)\n- add `handleClass` option.\n- add `makeWidget` method.\n- lodash v 4.x support (Thanks to @andrewr88)\n\n## v0.2.3 (2015-06-23)\n\n- gridstack-extra.css\n- add support of lodash.js\n- add `isAreaEmpty` method\n- nested grids\n- add `batchUpdate`/`commit` methods\n- add `update` method\n- allow to override `resizable`/`draggable` options\n- add `disable`/`enable` methods\n- add `getCellFromPixel` (thanks to @juchi)\n- AMD support\n- fix nodes sorting\n- improved touch devices support\n- add `alwaysShowResizeHandle` option\n- minor fixes and improvements\n\n## v0.2.2 (2014-12-23)\n\n- fix grid initialization\n- add `cellHeight`/`cellWidth` API methods\n- fix boolean attributes ([#31](https://github.com/gridstack/gridstack.js/issues/31))\n\n## v0.2.1 (2014-12-09)\n\n- add widgets locking ([#19](https://github.com/gridstack/gridstack.js/issues/19))\n- add `willItFit` API method\n- fix auto-positioning ([#20](https://github.com/gridstack/gridstack.js/issues/20))\n- add animation (thanks to @ishields)\n- fix `y` coordinate calculation when dragging ([#18](https://github.com/gridstack/gridstack.js/issues/18))\n- fix `removeWidget` ([#16](https://github.com/gridstack/gridstack.js/issues/16))\n- minor fixes\n\n\n## v0.2.0 (2014-11-30)\n\n- add `height` option\n- auto-generate css rules (widgets `height` and `top`)\n- add `GridStack.Utils.sort` utility function\n- add `removeAll` API method\n- add `resize` and `move` API methods\n- add `resizable` and `movable` API methods\n- add `data-gs-no-move` attribute\n- add `float` option\n- fix default css rule for inner content\n- minor fixes\n\n## v0.1.0 (2014-11-18)\n\nVery first version.\n"
  },
  {
    "path": "e2e/fixtures/gridstack-with-height.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>GridStack E2E Test - Drag and Drop</title>\n\n  <link rel=\"stylesheet\" href=\"../../demo/demo.css\"/>\n  <script src=\"../../dist/gridstack-all.js\"></script>\n\n  <style type=\"text/css\">\n    body {\n      margin: 20px;\n      font-family: Arial, sans-serif;\n    }\n    \n    .grid-stack {\n      background: #f0f0f0;\n      border: 2px solid #ccc;\n    }\n    \n    .grid-stack-item-content {\n      background: #18bc9c;\n      color: white;\n      text-align: center;\n      padding: 10px;\n      border-radius: 4px;\n      cursor: move;\n    }\n    \n    .grid-stack-item {\n      border: 1px solid #ddd;\n    }\n    \n    #outside-area {\n      margin-top: 20px;\n      padding: 20px;\n      background: #ffebee;\n      border: 2px dashed #f44336;\n      min-height: 100px;\n      text-align: center;\n    }\n  </style>\n</head>\n\n<body>\n  <h1>GridStack Drag and Drop Test</h1>\n  <p>Test dragging widgets outside the grid should not throw exceptions.</p>\n\n  <div id=\"grid\" class=\"grid-stack\">\n    <div id=\"item-1\" class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"0\" gs-w=\"2\" gs-h=\"2\">\n      <div class=\"grid-stack-item-content\">\n        Draggable Item 1\n      </div>\n    </div>\n    <div id=\"item-2\" class=\"grid-stack-item\" gs-x=\"2\" gs-y=\"0\" gs-w=\"2\" gs-h=\"1\">\n      <div class=\"grid-stack-item-content\">\n        Draggable Item 2\n      </div>\n    </div>\n    <div id=\"item-3\" class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"2\" gs-w=\"4\" gs-h=\"1\">\n      <div class=\"grid-stack-item-content\">\n        Draggable Item 3\n      </div>\n    </div>\n  </div>\n\n  <div id=\"outside-area\">\n    <p>Outside Grid Area - Try dragging items here</p>\n  </div>\n\n  <div id=\"console-output\" style=\"margin-top: 20px; padding: 10px; background: #f5f5f5; border-radius: 4px;\">\n    <h3>Console Output:</h3>\n    <div id=\"console-messages\"></div>\n  </div>\n\n  <script type=\"text/javascript\">\n    // Capture console errors for testing\n    const originalConsoleError = console.error;\n    const originalConsoleWarn = console.warn;\n    const consoleMessages = [];\n    \n    function logMessage(type, message) {\n      consoleMessages.push({ type, message, timestamp: Date.now() });\n      const messageDiv = document.createElement('div');\n      messageDiv.style.color = type === 'error' ? 'red' : 'orange';\n      messageDiv.textContent = `[${type.toUpperCase()}] ${message}`;\n      document.getElementById('console-messages').appendChild(messageDiv);\n    }\n    \n    console.error = function(...args) {\n      logMessage('error', args.join(' '));\n      originalConsoleError.apply(console, args);\n    };\n    \n    console.warn = function(...args) {\n      logMessage('warn', args.join(' '));\n      originalConsoleWarn.apply(console, args);\n    };\n    \n    // Expose console messages for testing\n    window.getConsoleMessages = () => consoleMessages;\n    window.clearConsoleMessages = () => {\n      consoleMessages.length = 0;\n      document.getElementById('console-messages').innerHTML = '';\n    };\n\n    // Initialize GridStack\n    const options = {\n      cellHeight: 80,\n      margin: 5,\n      float: false,\n      draggable: {\n        handle: '.grid-stack-item-content'\n      }\n    };\n    \n    const grid = GridStack.init(options);\n    \n    // Add event listeners for testing\n    grid.on('added removed change', function(e, items) {\n      console.log('Grid event:', e.type, items);\n    });\n    \n    grid.on('dragstart', function(e, node) {\n      console.log('Drag started for item:', node.id);\n    });\n    \n    grid.on('dragstop', function(e, node) {\n      console.log('Drag stopped for item:', node.id);\n    });\n\n    // Expose grid instance for testing\n    window.gridstack = grid;\n    window.testReady = true;\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "e2e/gridstack-e2e.spec.ts",
    "content": "import { test, expect } from '@playwright/test';\n\ntest.describe('GridStack E2E Tests', () => {\n  \n  test.beforeEach(async ({ page }) => {\n    // Navigate to the test page\n    await page.goto('/e2e/fixtures/gridstack-with-height.html');\n    \n    // Wait for GridStack to initialize\n    await page.waitForFunction(() => window.testReady === true);\n    await page.waitForSelector('.grid-stack-item', { state: 'visible' });\n  });\n\n  test('should not throw exceptions when dragging widget outside the grid', async ({ page }) => {\n    // Clear any existing console messages\n    await page.evaluate(() => window.clearConsoleMessages());\n    \n    // Get the widget and grid container\n    const widget = page.locator('#item-1 .grid-stack-item-content');\n    const gridContainer = page.locator('#grid');\n    const outsideArea = page.locator('#outside-area');\n    \n    // Verify widget is initially visible\n    await expect(widget).toBeVisible();\n    \n    // Get initial positions\n    const widgetBox = await widget.boundingBox();\n    const gridBox = await gridContainer.boundingBox();\n    const outsideBox = await outsideArea.boundingBox();\n    \n    expect(widgetBox).toBeTruthy();\n    expect(gridBox).toBeTruthy();\n    expect(outsideBox).toBeTruthy();\n    \n    // Perform drag operation from widget to outside area\n    await page.mouse.move(widgetBox!.x + widgetBox!.width / 2, widgetBox!.y + widgetBox!.height / 2);\n    await page.mouse.down();\n    \n    // Move to outside area\n    await page.mouse.move(outsideBox!.x + outsideBox!.width / 2, outsideBox!.y + outsideBox!.height / 2, { steps: 10 });\n    await page.mouse.up();\n    \n    // Wait a bit for any async operations\n    await page.waitForTimeout(500);\n    \n    // Check for console errors\n    const consoleMessages = await page.evaluate(() => window.getConsoleMessages());\n    const errors = consoleMessages.filter((msg: any) => msg.type === 'error');\n    \n    // Should not have any console errors\n    expect(errors).toHaveLength(0);\n    \n    // Widget should still exist in the DOM (even if moved back to grid)\n    await expect(widget).toBeVisible();\n  });\n\n  test('should handle drag and drop within grid correctly', async ({ page }) => {\n    await page.evaluate(() => window.clearConsoleMessages());\n    \n    const item1 = page.locator('#item-1 .grid-stack-item-content');\n    const item2 = page.locator('#item-2 .grid-stack-item-content');\n    \n    // Get initial positions\n    const item1Box = await item1.boundingBox();\n    const item2Box = await item2.boundingBox();\n    \n    expect(item1Box).toBeTruthy();\n    expect(item2Box).toBeTruthy();\n    \n    // Drag item 1 to where item 2 is\n    await page.mouse.move(item1Box!.x + item1Box!.width / 2, item1Box!.y + item1Box!.height / 2);\n    await page.mouse.down();\n    await page.mouse.move(item2Box!.x + item2Box!.width / 2, item2Box!.y + item2Box!.height / 2, { steps: 10 });\n    await page.mouse.up();\n    \n    // Wait for grid to settle\n    await page.waitForTimeout(500);\n    \n    // Check that grid events were fired\n    const consoleMessages = await page.evaluate(() => window.getConsoleMessages());\n    const hasGridEvents = consoleMessages.some((msg: any) => \n      msg.message.includes('Grid event:') || msg.message.includes('Drag')\n    );\n    \n    expect(hasGridEvents).toBe(true);\n    \n    // Should not have any errors\n    const errors = consoleMessages.filter((msg: any) => msg.type === 'error');\n    expect(errors).toHaveLength(0);\n  });\n\n  test('should validate auto-positioning HTML page', async ({ page }) => {\n    // Navigate to the auto-positioning test\n    await page.goto('/spec/e2e/html/1017-items-no-x-y-for-autoPosition.html');\n    \n    // Wait for GridStack to initialize\n    await page.waitForSelector('.grid-stack-item', { state: 'visible' });\n    await page.waitForFunction(() => typeof window.GridStack !== 'undefined');\n    \n    // Get all grid items\n    const items = await page.locator('.grid-stack-item').all();\n    expect(items).toHaveLength(5);\n    \n    // Check that item 5 is positioned at x=1, y=1 (it has explicit position)\n    const item5 = page.locator('[gs-id=\"5\"]');\n    await expect(item5).toBeVisible();\n    \n    // Check that all items are visible and positioned\n    for (let i = 1; i <= 5; i++) {\n      const item = page.locator(`[gs-id=\"${i}\"]`);\n      await expect(item).toBeVisible();\n      \n      // Get computed position via data attributes\n      const gsX = await item.getAttribute('gs-x');\n      const gsY = await item.getAttribute('gs-y');\n      \n      // Items should have valid positions (not null/undefined)\n      // Item 5 should maintain its explicit position\n      if (i === 5) {\n        expect(gsX).toBe('1');\n        expect(gsY).toBe('1');\n      }\n    }\n    \n    // Verify no items overlap by checking their computed positions\n    const gridInfo = await page.evaluate(() => {\n      const gridEl = document.querySelector('.grid-stack');\n      if (!gridEl || !window.GridStack) return null;\n      \n      const gridInstance = (window as any).GridStack.getGrids()[0];\n      if (!gridInstance) return null;\n      \n      return {\n        nodes: gridInstance.engine.nodes.map((node: any) => ({\n          id: node.id,\n          x: node.x,\n          y: node.y,\n          w: node.w,\n          h: node.h\n        }))\n      };\n    });\n    \n    expect(gridInfo).toBeTruthy();\n    expect(gridInfo!.nodes).toHaveLength(5);\n    \n    // Verify no overlaps\n    const nodes = gridInfo!.nodes;\n    for (let i = 0; i < nodes.length; i++) {\n      for (let j = i + 1; j < nodes.length; j++) {\n        const a = nodes[i];\n        const b = nodes[j];\n        \n        // Check if rectangles overlap\n        const overlap = !(\n          a.x + a.w <= b.x ||\n          b.x + b.w <= a.x ||\n          a.y + a.h <= b.y ||\n          b.y + b.h <= a.y\n        );\n        \n        expect(overlap).toBe(false);\n      }\n    }\n  });\n\n  test('should handle responsive behavior', async ({ page }) => {\n    await page.goto('/e2e/fixtures/gridstack-with-height.html');\n    await page.waitForFunction(() => window.testReady === true);\n    \n    // Test different viewport sizes\n    await page.setViewportSize({ width: 1200, height: 800 });\n    await page.waitForTimeout(100);\n    \n    let gridWidth = await page.locator('#grid').evaluate(el => el.offsetWidth);\n    expect(gridWidth).toBeGreaterThan(800);\n    \n    // Test mobile viewport\n    await page.setViewportSize({ width: 400, height: 600 });\n    await page.waitForTimeout(100);\n    \n    gridWidth = await page.locator('#grid').evaluate(el => el.offsetWidth);\n    expect(gridWidth).toBeLessThan(500);\n    \n    // Grid should still be functional\n    const items = await page.locator('.grid-stack-item').all();\n    expect(items.length).toBeGreaterThan(0);\n    \n    for (const item of items) {\n      await expect(item).toBeVisible();\n    }\n  });\n\n  test('getCellFromPixel should return correct coordinates', async ({ page }) => {\n    await page.goto('/e2e/fixtures/gridstack-with-height.html');\n    await page.waitForFunction(() => window.testReady === true);\n    \n    // Test getCellFromPixel with real browser layout\n    const result = await page.evaluate(() => {\n      const gridEl = document.querySelector('.grid-stack');\n      if (!gridEl || !window.GridStack) return null;\n      \n      const gridInstance = (window as any).GridStack.getGrids()[0];\n      if (!gridInstance) return null;\n      \n      const rect = gridEl.getBoundingClientRect();\n      const cellHeight = 80;\n      const smudge = 5;\n      \n      // Test pixel at column 4, row 5\n      const pixel = {\n        left: 4 * rect.width / 12 + rect.x + smudge, \n        top: 5 * cellHeight + rect.y + smudge\n      };\n      \n      const cell = gridInstance.getCellFromPixel(pixel);\n      \n      return {\n        cell,\n        rectWidth: rect.width,\n        rectHeight: rect.height,\n        pixel\n      };\n    });\n    \n    expect(result).toBeTruthy();\n    \n    // Verify we got realistic dimensions (not 0 like in jsdom)\n    expect(result!.rectWidth).toBeGreaterThan(0);\n    expect(result!.rectHeight).toBeGreaterThan(0);\n    \n    // Verify pixel coordinates are calculated correctly\n    expect(result!.cell.x).toBe(4);\n    expect(result!.cell.y).toBe(5);\n  });\n\n  test('cellWidth should return correct calculation', async ({ page }) => {\n    await page.goto('/e2e/fixtures/gridstack-with-height.html');\n    await page.waitForFunction(() => window.testReady === true);\n    \n    // Test cellWidth calculation with real browser layout\n    const result = await page.evaluate(() => {\n      const gridEl = document.querySelector('.grid-stack');\n      if (!gridEl || !window.GridStack) return null;\n      \n      const gridInstance = (window as any).GridStack.getGrids()[0];\n      if (!gridInstance) return null;\n      \n      const offsetWidth = gridEl.offsetWidth;\n      const cellWidth = gridInstance.cellWidth();\n      const expectedWidth = offsetWidth / 12; // Default 12 columns\n      \n      return {\n        offsetWidth,\n        cellWidth,\n        expectedWidth,\n        match: Math.abs(cellWidth - expectedWidth) < 0.1 // Allow small floating point differences\n      };\n    });\n    \n    expect(result).toBeTruthy();\n    \n    // Verify we got realistic dimensions\n    expect(result!.offsetWidth).toBeGreaterThan(0);\n    expect(result!.cellWidth).toBeGreaterThan(0);\n    \n    // Verify calculation is correct\n    expect(result!.match).toBe(true);\n    expect(result!.cellWidth).toBeCloseTo(result!.expectedWidth, 1);\n  });\n\n  test('cellHeight should affect computed styles', async ({ page }) => {\n    await page.goto('/e2e/fixtures/gridstack-with-height.html');\n    await page.waitForFunction(() => window.testReady === true);\n    \n    // Test cellHeight with real browser layout\n    const result = await page.evaluate(() => {\n      const gridEl = document.querySelector('.grid-stack');\n      if (!gridEl || !window.GridStack) return null;\n      \n      const gridInstance = (window as any).GridStack.getGrids()[0];\n      if (!gridInstance) return null;\n      \n      const initialHeight = gridInstance.getCellHeight();\n      const rows = parseInt(gridEl.getAttribute('gs-current-row') || '0');\n      const computedHeight = parseInt(getComputedStyle(gridEl)['height']);\n      \n      // Change cell height\n      gridInstance.cellHeight(120);\n      const newHeight = gridInstance.getCellHeight();\n      const newComputedHeight = parseInt(getComputedStyle(gridEl)['height']);\n      \n      return {\n        initialHeight,\n        rows,\n        computedHeight,\n        newHeight,\n        newComputedHeight,\n        expectedInitial: rows * initialHeight,\n        expectedNew: rows * 120\n      };\n    });\n    \n    expect(result).toBeTruthy();\n    \n    // Verify initial setup\n    expect(result!.initialHeight).toBeGreaterThan(0);\n    expect(result!.computedHeight).toBeCloseTo(result!.expectedInitial, 10); // Allow some margin for CSS differences\n    \n    // Verify height change\n    expect(result!.newHeight).toBe(120);\n    expect(result!.newComputedHeight).toBeCloseTo(result!.expectedNew, 10);\n  });\n\n  test('stylesheet should persist through DOM detach/attach', async ({ page }) => {\n    await page.goto('/e2e/fixtures/gridstack-with-height.html');\n    await page.waitForFunction(() => window.testReady === true);\n    \n    // Test that CSS styles persist when grid DOM is detached and reattached\n    const result = await page.evaluate(() => {\n      const gridEl = document.querySelector('.grid-stack');\n      if (!gridEl || !window.GridStack) return null;\n      \n      const gridInstance = (window as any).GridStack.getGrids()[0];\n      if (!gridInstance) return null;\n      \n      // Update cell height to 30px to match original test\n      gridInstance.cellHeight(30);\n      \n      // Get initial computed height of first item (should be 2 * 30 = 60px)\n      const item1 = gridEl.querySelector('#item-1') || gridEl.querySelector('.grid-stack-item');\n      if (!item1) return null;\n      \n      const initialHeight = window.getComputedStyle(item1).height;\n      \n      // Detach and reattach the grid container\n      const container = gridEl.parentElement;\n      const oldParent = container?.parentElement;\n      \n      if (!container || !oldParent) return null;\n      \n      container.remove();\n      oldParent.appendChild(container);\n      \n      // Get height after detach/reattach\n      const finalHeight = window.getComputedStyle(item1).height;\n      \n      return {\n        initialHeight,\n        finalHeight,\n        match: initialHeight === finalHeight\n      };\n    });\n    \n    expect(result).toBeTruthy();\n    \n    // Verify heights are calculated correctly and persist\n    expect(result!.initialHeight).toBe('60px'); // 2 rows * 30px cellHeight\n    expect(result!.finalHeight).toBe('60px');\n    expect(result!.match).toBe(true);\n  });\n});\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"gridstack\",\n  \"version\": \"12.4.3\",\n  \"license\": \"MIT\",\n  \"author\": \"Alain Dumesny <alaind831+github@gmail.com> (https://github.com/adumesny)\",\n  \"contributors\": [\n    \"Pavel Reznikov <pashka.reznikov@gmail.com>\",\n    \"Dylan Weiss <dylan.weiss@gmail.com> (https://dylandreams.com)\"\n  ],\n  \"description\": \"TypeScript/JS lib for dashboard layout and creation, responsive, mobile support, no external dependencies, with many wrappers (React, Angular, Vue, Ember, knockout...)\",\n  \"main\": \"./dist/gridstack.js\",\n  \"types\": \"./dist/gridstack.d.ts\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/gridstack/gridstack.js.git\"\n  },\n  \"funding\": [\n    {\n      \"type\": \"paypal\",\n      \"url\": \"https://www.paypal.me/alaind831\"\n    },\n    {\n      \"type\": \"venmo\",\n      \"url\": \"https://www.venmo.com/adumesny\"\n    }\n  ],\n  \"scripts\": {\n    \"build\": \"yarn build:ng && grunt && webpack && tsc --project tsconfig.build.json --stripInternal && yarn doc\",\n    \"build:ng\": \"cd angular && yarn build lib\",\n    \"w\": \"webpack\",\n    \"t\": \"rm -rf dist/* && grunt && tsc --project tsconfig.build.json --stripInternal\",\n    \"doc\": \"doctoc ./README.md && doctoc ./doc/CHANGES.md && node scripts/generate-docs.js\",\n    \"doc:main\": \"node scripts/generate-docs.js --main-only\",\n    \"doc:angular\": \"node scripts/generate-docs.js --angular-only\",\n    \"test\": \"yarn lint && vitest run\",\n    \"test:watch\": \"vitest\",\n    \"test:ui\": \"vitest --ui\",\n    \"test:coverage\": \"vitest run --coverage\",\n    \"test:coverage:ui\": \"vitest --ui --coverage.enabled=true\",\n    \"test:coverage:detailed\": \"vitest run --config .vitestrc.coverage.ts\",\n    \"test:coverage:html\": \"vitest run --coverage && open coverage/index.html\",\n    \"test:coverage:lcov\": \"vitest run --coverage --coverage.reporter=lcov\",\n    \"test:ci\": \"vitest run --coverage --reporter=verbose --reporter=junit --outputFile.junit=./coverage/junit-report.xml\",\n    \"test:e2e\": \"playwright test\",\n    \"test:e2e:ui\": \"playwright test --ui\",\n    \"test:e2e:headed\": \"playwright test --headed\",\n    \"lint\": \"tsc --project tsconfig.build.json --noEmit && eslint src/*.ts angular/projects/lib/src/**/*.ts\",\n    \"reset\": \"rm -rf dist node_modules\",\n    \"prepublishOnly\": \"yarn build\"\n  },\n  \"keywords\": [\n    \"Typescript\",\n    \"gridstack.js\",\n    \"grid\",\n    \"gridster\",\n    \"layout\",\n    \"responsive\",\n    \"dashboard\",\n    \"resize\",\n    \"drag&drop\",\n    \"widgets\",\n    \"Angular\",\n    \"React\",\n    \"Vue\",\n    \"JavaScript\"\n  ],\n  \"bugs\": {\n    \"url\": \"https://github.com/gridstack/gridstack.js/issues\"\n  },\n  \"homepage\": \"http://gridstackjs.com/\",\n  \"dependencies\": {},\n  \"devDependencies\": {\n    \"@playwright/test\": \"^1.48.2\",\n    \"@testing-library/dom\": \"^10.4.0\",\n    \"@testing-library/jest-dom\": \"^6.4.8\",\n    \"@typescript-eslint/eslint-plugin\": \"^5.58.0\",\n    \"@typescript-eslint/parser\": \"^5.58.0\",\n    \"@vitest/coverage-v8\": \"^2.0.5\",\n    \"@vitest/ui\": \"^2.0.5\",\n    \"connect\": \"^3.7.0\",\n    \"core-js\": \"^3.30.1\",\n    \"coveralls\": \"^3.1.1\",\n    \"doctoc\": \"^2.2.1\",\n    \"eslint\": \"^8.38.0\",\n    \"grunt\": \"^1.6.1\",\n    \"grunt-cli\": \"^1.3.2\",\n    \"grunt-contrib-connect\": \"^3.0.0\",\n    \"grunt-contrib-copy\": \"^1.0.0\",\n    \"grunt-contrib-cssmin\": \"^4.0.0\",\n    \"grunt-contrib-uglify\": \"^5.2.2\",\n    \"grunt-contrib-watch\": \"^1.1.0\",\n    \"grunt-eslint\": \"^24.0.1\",\n    \"grunt-protractor-runner\": \"^5.0.0\",\n    \"grunt-protractor-webdriver\": \"^0.2.5\",\n    \"grunt-sass\": \"3.1.0\",\n    \"happy-dom\": \"^20.0.0\",\n    \"jsdom\": \"^25.0.0\",\n    \"protractor\": \"^7.0.0\",\n    \"sass\": \"^1.62.0\",\n    \"serve-static\": \"^1.15.0\",\n    \"ts-loader\": \"^9.4.2\",\n    \"typedoc\": \"^0.28.9\",\n    \"typedoc-plugin-markdown\": \"^4.8.0\",\n    \"typescript\": \"^5.0.4\",\n    \"vitest\": \"^2.0.5\",\n    \"webpack\": \"^5.79.0\",\n    \"webpack-cli\": \"^5.0.1\"\n  },\n  \"packageManager\": \"yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e\",\n  \"files\": [\n    \"dist\",\n    \"doc/API.md\"\n  ]\n}\n"
  },
  {
    "path": "playwright.config.ts",
    "content": "import { defineConfig, devices } from '@playwright/test';\n\n/**\n * @see https://playwright.dev/docs/test-configuration\n */\nexport default defineConfig({\n  testDir: './e2e',\n  /* Run tests in files in parallel */\n  fullyParallel: true,\n  /* Fail the build on CI if you accidentally left test.only in the source code. */\n  forbidOnly: !!process.env.CI,\n  /* Retry on CI only */\n  retries: process.env.CI ? 2 : 0,\n  /* Opt out of parallel tests on CI. */\n  workers: process.env.CI ? 1 : undefined,\n  /* Reporter to use. See https://playwright.dev/docs/test-reporters */\n  reporter: [\n    ['html', { outputFolder: 'e2e-report' }],\n    ['json', { outputFile: 'e2e-report/results.json' }],\n    ['junit', { outputFile: 'e2e-report/results.xml' }]\n  ],\n  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */\n  use: {\n    /* Base URL to use in actions like `await page.goto('/')`. */\n    baseURL: 'http://localhost:8080',\n\n    /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */\n    trace: 'on-first-retry',\n    \n    /* Take screenshot on failure */\n    screenshot: 'only-on-failure',\n    \n    /* Record video on failure */\n    video: 'retain-on-failure',\n  },\n\n  /* Configure projects for major browsers */\n  projects: [\n    {\n      name: 'chromium',\n      use: { ...devices['Desktop Chrome'] },\n    },\n\n    {\n      name: 'firefox',\n      use: { ...devices['Desktop Firefox'] },\n    },\n\n    {\n      name: 'webkit',\n      use: { ...devices['Desktop Safari'] },\n    },\n\n    /* Test against mobile viewports. */\n    {\n      name: 'Mobile Chrome',\n      use: { ...devices['Pixel 5'] },\n    },\n    {\n      name: 'Mobile Safari',\n      use: { ...devices['iPhone 12'] },\n    },\n  ],\n\n  /* Run your local dev server before starting the tests */\n  webServer: {\n    command: 'npx serve -l 8080 .',\n    port: 8080,\n    reuseExistingServer: !process.env.CI,\n  },\n});\n"
  },
  {
    "path": "protractor.conf.js",
    "content": "exports.config = {\n  seleniumAddress: 'http://localhost:4444/wd/hub',\n  specs: ['spec/e2e/*-spec.js'],\n  capabilities: {\n    browserName: 'firefox',\n    version: '',\n    platform: 'ANY',\n    loggingPrefs: {\n      browser: 'SEVERE'\n    }\n  },\n};\n"
  },
  {
    "path": "react/.gitignore",
    "content": "# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\npnpm-debug.log*\nlerna-debug.log*\n\nnode_modules\ndist\ndist-ssr\n*.local\n\n# Editor directories and files\n.vscode/*\n!.vscode/extensions.json\n.idea\n.DS_Store\n*.suo\n*.ntvs*\n*.njsproj\n*.sln\n*.sw?\n"
  },
  {
    "path": "react/README.md",
    "content": "# React GridStack Wrapper Demo\n\nA React wrapper component for GridStack that provides better TypeScript support and React integration experience.\n\n## TODO\n\n- [x] Component mapping\n- [x] SubGrid support\n- [ ] Save and restore layout\n- [ ] Publish to npm\n\n## Basic Usage\n\nThis is not an npm package, it's just a demo project. Please copy the relevant code to your project to use it.\n\n```tsx\nimport {\n  GridStackProvider,\n  GridStackRender,\n  GridStackRenderProvider,\n} from \"path/to/lib\";\nimport \"gridstack/dist/gridstack.css\";\nimport \"path/to/demo.css\";\n\nfunction Text({ content }: { content: string }) {\n  return <div>{content}</div>;\n}\n\nconst COMPONENT_MAP = {\n  Text,\n  // ... other components\n};\n\n// Grid options\nconst gridOptions = {\n  acceptWidgets: true,\n  margin: 8,\n  cellHeight: 50,\n  children: [\n    {\n      id: \"item1\",\n      h: 2,\n      w: 2,\n      content: JSON.stringify({\n        name: \"Text\",\n        props: { content: \"Item 1\" },\n      }),\n    },\n    // ... other grid items\n  ],\n};\n\nfunction App() {\n  return (\n    <GridStackProvider initialOptions={gridOptions}>\n      <!-- Maybe a toolbar here. Access to addWidget and addSubGrid by useGridStackContext() -->\n\n      <!-- Grid Stack Root Element -->\n      <GridStackRenderProvider>\n        <!-- Grid Stack Default Render -->\n        <GridStackRender componentMap={COMPONENT_MAP} />\n      </GridStackRenderProvider>\n\n      <!-- Maybe other UI here -->\n    </GridStackProvider>\n  );\n}\n```\n\n## Advanced Features\n\n### Toolbar Operations\n\nProvide APIs to add new components and sub-grids:\n\n```tsx\nfunction Toolbar() {\n  const { addWidget, addSubGrid } = useGridStackContext();\n\n  return (\n    <div>\n      <button onClick={() => addWidget(/* ... */)}>Add Component</button>\n      <button onClick={() => addSubGrid(/* ... */)}>Add SubGrid</button>\n    </div>\n  );\n}\n```\n\n### Layout Saving\n\nGet the current layout:\n\n```tsx\nconst { saveOptions } = useGridStackContext();\n\nconst currentLayout = saveOptions();\n```\n\n## API Reference\n\n### GridStackProvider\n\nThe main context provider, accepts the following properties:\n\n- `initialOptions`: Initial configuration options for GridStack\n\n### GridStackRender\n\nThe core component for rendering the grid, accepts the following properties:\n\n- `componentMap`: A mapping from component names to actual React components\n\n### Hooks\n\n- `useGridStackContext()`: Access GridStack context and operations\n  - `addWidget`: Add a new component\n  - `addSubGrid`: Add a new sub-grid\n  - `saveOptions`: Save current layout\n  - `initialOptions`: Initial configuration options\n"
  },
  {
    "path": "react/eslint.config.js",
    "content": "import js from '@eslint/js'\nimport globals from 'globals'\nimport reactHooks from 'eslint-plugin-react-hooks'\nimport reactRefresh from 'eslint-plugin-react-refresh'\nimport tseslint from 'typescript-eslint'\n\nexport default tseslint.config(\n  { ignores: ['dist'] },\n  {\n    extends: [js.configs.recommended, ...tseslint.configs.recommended],\n    files: ['**/*.{ts,tsx}'],\n    languageOptions: {\n      ecmaVersion: 2020,\n      globals: globals.browser,\n    },\n    plugins: {\n      'react-hooks': reactHooks,\n      'react-refresh': reactRefresh,\n    },\n    rules: {\n      ...reactHooks.configs.recommended.rules,\n      'react-refresh/only-export-components': [\n        'warn',\n        { allowConstantExport: true },\n      ],\n    },\n  },\n)\n"
  },
  {
    "path": "react/index.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <link rel=\"icon\" type=\"image/svg+xml\" href=\"/vite.svg\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Vite + React + TS</title>\n  </head>\n  <body>\n    <div id=\"root\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "react/lib/grid-stack-context.ts",
    "content": "import type { GridStack, GridStackOptions, GridStackWidget } from \"gridstack\";\nimport { createContext, useContext } from \"react\";\n\nexport const GridStackContext = createContext<{\n  initialOptions: GridStackOptions;\n  gridStack: GridStack | null;\n  addWidget: (widget: GridStackWidget & { id: Required<GridStackWidget>[\"id\"] }) => void;\n  removeWidget: (id: string) => void;\n  addSubGrid: (\n    subGrid: GridStackWidget & { \n      id: Required<GridStackWidget>[\"id\"]; \n      subGridOpts: Required<GridStackWidget>[\"subGridOpts\"] & { \n        children: Array<GridStackWidget & { id: Required<GridStackWidget>[\"id\"] }> \n      } \n    }\n  ) => void;\n  saveOptions: () => GridStackOptions | GridStackWidget[] | undefined;\n  removeAll: () => void;\n\n  _gridStack: {\n    value: GridStack | null;\n    set: React.Dispatch<React.SetStateAction<GridStack | null>>;\n  };\n  _rawWidgetMetaMap: {\n    value: Map<string, GridStackWidget>;\n    set: React.Dispatch<React.SetStateAction<Map<string, GridStackWidget>>>;\n  };\n} | null>(null);\n\nexport function useGridStackContext() {\n  const context = useContext(GridStackContext);\n  if (!context) {\n    throw new Error(\n      \"useGridStackContext must be used within a GridStackProvider\"\n    );\n  }\n  return context;\n}\n"
  },
  {
    "path": "react/lib/grid-stack-provider.tsx",
    "content": "import type { GridItemHTMLElement, GridStack, GridStackOptions, GridStackWidget } from \"gridstack\";\nimport { type PropsWithChildren, useCallback, useState } from \"react\";\nimport { GridStackContext } from \"./grid-stack-context\";\n\nexport function GridStackProvider({\n  children,\n  initialOptions,\n}: PropsWithChildren<{ initialOptions: GridStackOptions }>) {\n  const [gridStack, setGridStack] = useState<GridStack | null>(null);\n  const [rawWidgetMetaMap, setRawWidgetMetaMap] = useState(() => {\n    const map = new Map<string, GridStackWidget>();\n    const deepFindNodeWithContent = (obj: GridStackWidget) => {\n      if (obj.id && obj.content) {\n        map.set(obj.id, obj);\n      }\n      if (obj.subGridOpts?.children) {\n        obj.subGridOpts.children.forEach((child: GridStackWidget) => {\n          deepFindNodeWithContent(child);\n        });\n      }\n    };\n    initialOptions.children?.forEach((child: GridStackWidget) => {\n      deepFindNodeWithContent(child);\n    });\n    return map;\n  });\n\n  const addWidget = useCallback(\n    (widget: GridStackWidget & { id: Required<GridStackWidget>[\"id\"] })  => {\n      gridStack?.addWidget(widget);\n      setRawWidgetMetaMap((prev) => {\n        const newMap = new Map<string, GridStackWidget>(prev);\n        newMap.set(widget.id, widget);\n        return newMap;\n      });\n    },\n    [gridStack]\n  );\n\n  const addSubGrid = useCallback(\n    (subGrid: GridStackWidget & { \n      id: Required<GridStackWidget>[\"id\"]; \n      subGridOpts: Required<GridStackWidget>[\"subGridOpts\"] & { \n        children: Array<GridStackWidget & { id: Required<GridStackWidget>[\"id\"] }> \n      } \n    }) => {\n      gridStack?.addWidget(subGrid);\n\n      setRawWidgetMetaMap((prev) => {\n        const newMap = new Map<string, GridStackWidget>(prev);\n        subGrid.subGridOpts?.children?.forEach((meta: GridStackWidget & { id: Required<GridStackWidget>[\"id\"] }) => {\n          newMap.set(meta.id, meta);\n        });\n        return newMap;\n      });\n    },\n    [gridStack]\n  );\n\n  const removeWidget = useCallback(\n    (id: string) => {\n      const element = document.body.querySelector<GridItemHTMLElement>(`[gs-id=\"${id}\"]`);\n      if (element) gridStack?.removeWidget(element);\n\n      setRawWidgetMetaMap((prev) => {\n        const newMap = new Map<string, GridStackWidget>(prev);\n        newMap.delete(id);\n        return newMap;\n      });\n    },\n    [gridStack]\n  );\n\n  const saveOptions = useCallback(() => {\n    return gridStack?.save(true, true, (_, widget) => widget);\n  }, [gridStack]);\n\n  const removeAll = useCallback(() => {\n    gridStack?.removeAll();\n    setRawWidgetMetaMap(new Map<string, GridStackWidget>());\n  }, [gridStack]);\n\n  return (\n    <GridStackContext.Provider\n      value={{\n        initialOptions,\n        gridStack,\n\n        addWidget,\n        removeWidget,\n        addSubGrid,\n        saveOptions,\n        removeAll,\n\n        _gridStack: {\n          value: gridStack,\n          set: setGridStack,\n        },\n        _rawWidgetMetaMap: {\n          value: rawWidgetMetaMap,\n          set: setRawWidgetMetaMap,\n        },\n      }}\n    >\n      {children}\n    </GridStackContext.Provider>\n  );\n}\n"
  },
  {
    "path": "react/lib/grid-stack-render-context.ts",
    "content": "import { createContext, useContext } from \"react\";\n\nexport const GridStackRenderContext = createContext<{\n  getWidgetContainer: (widgetId: string) => HTMLElement | null;\n} | null>(null);\n\nexport function useGridStackRenderContext() {\n  const context = useContext(GridStackRenderContext);\n  if (!context) {\n    throw new Error(\n      \"useGridStackRenderContext must be used within a GridStackProvider\"\n    );\n  }\n  return context;\n}\n"
  },
  {
    "path": "react/lib/grid-stack-render-provider.test.tsx",
    "content": "import { describe, it, expect, beforeEach, vi } from 'vitest';\r\nimport { gridWidgetContainersMap } from './grid-stack-render-provider';\r\n\r\n// Mock GridStack type\r\nclass MockGridStack {\r\n  el: HTMLElement;\r\n  constructor() {\r\n    this.el = document.createElement('div');\r\n  }\r\n}\r\n\r\ndescribe('GridStackRenderProvider', () => {\r\n  beforeEach(() => {\r\n    // Clear the WeakMap before each test\r\n    gridWidgetContainersMap.constructor.prototype.clear?.call(gridWidgetContainersMap);\r\n  });\r\n\r\n  it('should store widget containers in WeakMap for each grid instance', () => {\r\n    // Mock grid instances\r\n    const grid1 = new MockGridStack() as any;\r\n    const grid2 = new MockGridStack() as any;\r\n    const widget1 = { id: '1', grid: grid1 };\r\n    const widget2 = { id: '2', grid: grid2 };\r\n    const element1 = document.createElement('div');\r\n    const element2 = document.createElement('div');\r\n    \r\n    // Simulate renderCB\r\n    const renderCB = (element, widget) => {\r\n      if (widget.id && widget.grid) {\r\n        // Get or create the widget container map for this grid instance\r\n        let containers = gridWidgetContainersMap.get(widget.grid);\r\n        if (!containers) {\r\n          containers = new Map();\r\n          gridWidgetContainersMap.set(widget.grid, containers);\r\n        }\r\n        containers.set(widget.id, element);\r\n      }\r\n    };\r\n\r\n    renderCB(element1, widget1);\r\n    renderCB(element2, widget2);\r\n\r\n    const containers1 = gridWidgetContainersMap.get(grid1);\r\n    const containers2 = gridWidgetContainersMap.get(grid2);\r\n\r\n    expect(containers1?.get('1')).toBe(element1);\r\n    expect(containers2?.get('2')).toBe(element2);\r\n  });\r\n\r\n  it('should not have containers for different grid instances mixed up', () => {\r\n    const grid1 = new MockGridStack() as any;\r\n    const grid2 = new MockGridStack() as any;\r\n    const widget1 = { id: '1', grid: grid1 };\r\n    const widget2 = { id: '2', grid: grid1 };\r\n    const widget3 = { id: '3', grid: grid2 };\r\n    const element1 = document.createElement('div');\r\n    const element2 = document.createElement('div');\r\n    const element3 = document.createElement('div');\r\n\r\n    // Simulate renderCB\r\n    const renderCB = (element: HTMLElement, widget: any) => {\r\n      if (widget.id && widget.grid) {\r\n        let containers = gridWidgetContainersMap.get(widget.grid);\r\n        if (!containers) {\r\n          containers = new Map();\r\n          gridWidgetContainersMap.set(widget.grid, containers);\r\n        }\r\n        containers.set(widget.id, element);\r\n      }\r\n    };\r\n\r\n    renderCB(element1, widget1);\r\n    renderCB(element2, widget2);\r\n    renderCB(element3, widget3);\r\n\r\n    const containers1 = gridWidgetContainersMap.get(grid1);\r\n    const containers2 = gridWidgetContainersMap.get(grid2);\r\n\r\n    // Grid1 should have widgets 1 and 2\r\n    expect(containers1?.size).toBe(2);\r\n    expect(containers1?.get('1')).toBe(element1);\r\n    expect(containers1?.get('2')).toBe(element2);\r\n    expect(containers1?.get('3')).toBeUndefined();\r\n\r\n    // Grid2 should only have widget 3\r\n    expect(containers2?.size).toBe(1);\r\n    expect(containers2?.get('3')).toBe(element3);\r\n    expect(containers2?.get('1')).toBeUndefined();\r\n    expect(containers2?.get('2')).toBeUndefined();\r\n  });\r\n\r\n  it('should clean up when grid instance is deleted from WeakMap', () => {\r\n    const grid = new MockGridStack() as any;\r\n    const widget = { id: '1', grid };\r\n    const element = document.createElement('div');\r\n\r\n    // Add to WeakMap\r\n    const containers = new Map<string, HTMLElement>();\r\n    containers.set(widget.id, element);\r\n    gridWidgetContainersMap.set(grid, containers);\r\n\r\n    // Verify it exists\r\n    expect(gridWidgetContainersMap.has(grid)).toBe(true);\r\n\r\n    // Delete from WeakMap\r\n    gridWidgetContainersMap.delete(grid);\r\n\r\n    // Verify it's gone\r\n    expect(gridWidgetContainersMap.has(grid)).toBe(false);\r\n  });\r\n\r\n  it('should handle multiple widgets in the same grid', () => {\r\n    const grid = new MockGridStack() as any;\r\n    const widgets = [\r\n      { id: '1', grid },\r\n      { id: '2', grid },\r\n      { id: '3', grid },\r\n    ];\r\n    const elements = widgets.map(() => document.createElement('div'));\r\n\r\n    // Simulate renderCB for all widgets\r\n    widgets.forEach((widget, index) => {\r\n      const element = elements[index];\r\n      if (widget.id && widget.grid) {\r\n        let containers = gridWidgetContainersMap.get(widget.grid);\r\n        if (!containers) {\r\n          containers = new Map();\r\n          gridWidgetContainersMap.set(widget.grid, containers);\r\n        }\r\n        containers.set(widget.id, element);\r\n      }\r\n    });\r\n\r\n    const containers = gridWidgetContainersMap.get(grid);\r\n    expect(containers?.size).toBe(3);\r\n    expect(containers?.get('1')).toBe(elements[0]);\r\n    expect(containers?.get('2')).toBe(elements[1]);\r\n    expect(containers?.get('3')).toBe(elements[2]);\r\n  });\r\n});\r\n\r\n"
  },
  {
    "path": "react/lib/grid-stack-render-provider.tsx",
    "content": "import {\n  PropsWithChildren,\n  useCallback,\n  useLayoutEffect,\n  useMemo,\n  useRef,\n  useReducer,\n} from \"react\";\nimport { useGridStackContext } from \"./grid-stack-context\";\nimport { GridStack, GridStackOptions, GridStackWidget } from \"gridstack\";\nimport { GridStackRenderContext } from \"./grid-stack-render-context\";\nimport isEqual from \"react-fast-compare\";\n\n// WeakMap to store widget containers for each grid instance\nexport const gridWidgetContainersMap = new WeakMap<\n  GridStack,\n  Map<string, HTMLElement>\n>();\n\nexport function GridStackRenderProvider({ children }: PropsWithChildren) {\n  const {\n    _gridStack: { value: gridStack, set: setGridStack },\n    initialOptions,\n  } = useGridStackContext();\n\n  const widgetContainersRef = useRef<Map<string, HTMLElement>>(new Map());\n  const containerRef = useRef<HTMLDivElement>(null);\n  const optionsRef = useRef<GridStackOptions>(initialOptions);\n  const [renderTick, forceRerender] = useReducer((value) => value + 1, 0);\n\n  const renderCBFn = useCallback(\n    (element: HTMLElement, widget: GridStackWidget & { grid?: GridStack }) => {\n      if (widget.id && widget.grid) {\n        // Get or create the widget container map for this grid instance\n        let containers = gridWidgetContainersMap.get(widget.grid);\n        if (!containers) {\n          containers = new Map<string, HTMLElement>();\n          gridWidgetContainersMap.set(widget.grid, containers);\n        }\n        containers.set(widget.id, element);\n\n        // Also update the local ref for backward compatibility\n        widgetContainersRef.current.set(widget.id, element);\n\n        if (widget.lazyLoad || optionsRef.current.lazyLoad) {\n          // We need to force a re-render, since React has\n          // already eagerly rendered all widgets in the grid\n          forceRerender();\n        }\n      }\n    },\n    []\n  );\n\n  const initGrid = useCallback(() => {\n    if (containerRef.current) {\n      GridStack.renderCB = renderCBFn;\n      return GridStack.init(optionsRef.current, containerRef.current);\n      // ! Change event not firing on nested grids (resize, move...) https://github.com/gridstack/gridstack.js/issues/2671\n      // .on(\"change\", () => {\n      //   console.log(\"changed\");\n      // })\n      // .on(\"resize\", () => {\n      //   console.log(\"resize\");\n      // })\n    }\n    return null;\n  }, [renderCBFn]);\n\n  useLayoutEffect(() => {\n    if (!isEqual(initialOptions, optionsRef.current) && gridStack) {\n      try {\n        gridStack.removeAll(false);\n        gridStack.destroy(false);\n        widgetContainersRef.current.clear();\n        // Clean up the WeakMap entry for this grid instance\n        gridWidgetContainersMap.delete(gridStack);\n        optionsRef.current = initialOptions;\n        setGridStack(initGrid());\n      } catch (e) {\n        console.error(\"Error reinitializing gridstack\", e);\n      }\n    }\n  }, [initialOptions, gridStack, initGrid, setGridStack]);\n\n  useLayoutEffect(() => {\n    if (!gridStack) {\n      try {\n        setGridStack(initGrid());\n      } catch (e) {\n        console.error(\"Error initializing gridstack\", e);\n      }\n    }\n  }, [gridStack, initGrid, setGridStack]);\n\n  return (\n    <GridStackRenderContext.Provider\n      value={useMemo(\n        () => ({\n          getWidgetContainer: (widgetId: string) => {\n            // First try to get from the current grid instance's map\n            if (gridStack) {\n              const containers = gridWidgetContainersMap.get(gridStack);\n              if (containers?.has(widgetId)) {\n                return containers.get(widgetId) || null;\n              }\n            }\n            // Fallback to local ref for backward compatibility\n            return widgetContainersRef.current.get(widgetId) || null;\n          },\n        }),\n        // ! gridStack is required to reinitialize the grid when the options change\n        // eslint-disable-next-line react-hooks/exhaustive-deps\n        [gridStack, renderTick]\n      )}\n    >\n      <div ref={containerRef}>{gridStack ? children : null}</div>\n    </GridStackRenderContext.Provider>\n  );\n}\n"
  },
  {
    "path": "react/lib/grid-stack-render.tsx",
    "content": "import { useRef, memo } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { useGridStackContext } from \"./grid-stack-context\";\nimport { useGridStackRenderContext } from \"./grid-stack-render-context\";\nimport { GridStackWidgetContext } from \"./grid-stack-widget-context\";\nimport { GridStackWidget } from \"gridstack\";\nimport { ComponentType } from \"react\";\n\nexport interface ComponentDataType<T = object> {\n  name: string;\n  props: T;\n}\n\ntype ParsedComponentData = ComponentDataType & {\n  error: unknown;\n  metaHash: string;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type ComponentMap = Record<string, ComponentType<any>>;\n\nfunction parseWeightMetaToComponentData(\n  meta: GridStackWidget,\n  cache: Map<string, ParsedComponentData>\n): ComponentDataType & { error: unknown } {\n  const cacheKey = meta.id ?? \"\";\n  const metaHash = meta.content ?? \"\";\n  const cached = cache.get(cacheKey);\n  // Ensure componentData is immutable between renders\n  if (cached && cached.metaHash === metaHash) return cached;\n\n  let error = null;\n  let name = \"\";\n  let props = {};\n  try {\n    if (meta.content) {\n      const result = JSON.parse(meta.content) as {\n        name: string;\n        props: object;\n      };\n      name = result.name;\n      props = result.props;\n    }\n  } catch (e) {\n    error = e;\n  }\n  const parsed: ParsedComponentData = {\n    name,\n    props,\n    error,\n    metaHash,\n  };\n  cache.set(cacheKey, parsed);\n  return parsed;\n}\n\ntype WidgetMemoProps = {\n  id: string;\n  componentData: ComponentDataType;\n  widgetContainer: HTMLElement;\n  WidgetComponent: ComponentType<unknown>;\n};\n\nconst WidgetMemo = memo(\n  ({\n    id,\n    componentData,\n    widgetContainer,\n    WidgetComponent,\n  }: WidgetMemoProps) => {\n    return (\n      <GridStackWidgetContext.Provider value={{ widget: { id } }}>\n        {createPortal(\n          <WidgetComponent {...componentData.props} />,\n          widgetContainer\n        )}\n      </GridStackWidgetContext.Provider>\n    );\n  }\n);\nWidgetMemo.displayName = \"WidgetMemo\";\n\nexport function GridStackRender(props: { componentMap: ComponentMap }) {\n  const { _rawWidgetMetaMap } = useGridStackContext();\n  const { getWidgetContainer } = useGridStackRenderContext();\n  const parsedCache = useRef<Map<string, ParsedComponentData>>(new Map());\n\n  return (\n    <>\n      {Array.from(_rawWidgetMetaMap.value.entries()).map(([id, meta]) => {\n        const componentData = parseWeightMetaToComponentData(\n          meta,\n          parsedCache.current\n        );\n\n        const WidgetComponent = props.componentMap[componentData.name];\n\n        const widgetContainer = getWidgetContainer(id);\n\n        if (!widgetContainer) {\n          return null;\n        }\n\n        return (\n          <WidgetMemo\n            id={id}\n            key={id}\n            componentData={componentData}\n            widgetContainer={widgetContainer}\n            WidgetComponent={WidgetComponent}\n          />\n        );\n      })}\n    </>\n  );\n}\n"
  },
  {
    "path": "react/lib/grid-stack-widget-context.ts",
    "content": "import { createContext, useContext } from \"react\";\n\n// TODO: support full widget metadata\nexport const GridStackWidgetContext = createContext<{\n  widget: {\n    id: string;\n  };\n} | null>(null);\n\nexport function useGridStackWidgetContext() {\n  const context = useContext(GridStackWidgetContext);\n  if (!context) {\n    throw new Error(\n      \"useGridStackWidgetContext must be used within a GridStackWidgetProvider\"\n    );\n  }\n  return context;\n}\n"
  },
  {
    "path": "react/lib/index.ts",
    "content": "import { GridStackProvider } from \"./grid-stack-provider\";\nimport { GridStackRenderProvider } from \"./grid-stack-render-provider\";\nimport {\n  GridStackRender,\n  ComponentDataType,\n  ComponentMap,\n} from \"./grid-stack-render\";\nimport { useGridStackContext } from \"./grid-stack-context\";\nimport { useGridStackWidgetContext } from \"./grid-stack-widget-context\";\n\nexport {\n  GridStackProvider,\n  GridStackRenderProvider,\n  GridStackRender,\n  type ComponentDataType,\n  type ComponentMap,\n  useGridStackContext,\n  useGridStackWidgetContext,\n};\n"
  },
  {
    "path": "react/package.json",
    "content": "{\n  \"name\": \"react\",\n  \"private\": true,\n  \"version\": \"0.0.0\",\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite\",\n    \"start\": \"vite\",\n    \"build\": \"tsc -b && vite build\",\n    \"lint\": \"eslint .\",\n    \"preview\": \"vite preview\",\n    \"test\": \"vitest\",\n    \"test:ui\": \"vitest --ui\"\n  },\n  \"dependencies\": {\n    \"gridstack\": \"^12.4.2\",\n    \"react\": \"^18.3.1\",\n    \"react-dom\": \"^18.3.1\",\n    \"react-fast-compare\": \"^3.2.2\",\n    \"vitest\": \"^3.2.4\"\n  },\n  \"devDependencies\": {\n    \"@eslint/js\": \"^9.9.0\",\n    \"@types/react\": \"^18.3.3\",\n    \"@types/react-dom\": \"^18.3.0\",\n    \"@vitejs/plugin-react-swc\": \"^3.5.0\",\n    \"@vitest/ui\": \"^3.2.4\",\n    \"eslint\": \"^9.9.0\",\n    \"eslint-plugin-react-hooks\": \"^5.1.0-rc.0\",\n    \"eslint-plugin-react-refresh\": \"^0.4.9\",\n    \"globals\": \"^15.9.0\",\n    \"jsdom\": \"^26.1.0\",\n    \"typescript\": \"^5.5.3\",\n    \"typescript-eslint\": \"^8.0.1\",\n    \"vite\": \"^5.4.21\"\n  }\n}\n"
  },
  {
    "path": "react/src/App.tsx",
    "content": "import { GridStackDemo } from \"./demo/demo\";\n\nfunction App() {\n  return (\n    <>\n      <h1>Gridstack React Wrapper Demo</h1>\n\n      <h3>(Uncontrolled)</h3>\n      <GridStackDemo />\n    </>\n  );\n}\n\nexport default App;\n"
  },
  {
    "path": "react/src/demo/demo.css",
    "content": ".grid-stack {\n  background: #FAFAD2;\n}\n\n.grid-stack-item-content {\n  text-align: center;\n  background-color: #18bc9c;\n}\n\n.grid-stack-item-removing {\n  opacity: 0.5;\n}\n.trash {\n  height: 100px;\n  background: rgba(255, 0, 0, 0.1) center center url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjY0cHgiIGhlaWdodD0iNjRweCIgdmlld0JveD0iMCAwIDQzOC41MjkgNDM4LjUyOSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNDM4LjUyOSA0MzguNTI5OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPGc+CgkJPHBhdGggZD0iTTQxNy42ODksNzUuNjU0Yy0xLjcxMS0xLjcwOS0zLjkwMS0yLjU2OC02LjU2My0yLjU2OGgtODguMjI0TDMwMi45MTcsMjUuNDFjLTIuODU0LTcuMDQ0LTcuOTk0LTEzLjA0LTE1LjQxMy0xNy45ODkgICAgQzI4MC4wNzgsMi40NzMsMjcyLjU1NiwwLDI2NC45NDUsMGgtOTEuMzYzYy03LjYxMSwwLTE1LjEzMSwyLjQ3My0yMi41NTQsNy40MjFjLTcuNDI0LDQuOTQ5LTEyLjU2MywxMC45NDQtMTUuNDE5LDE3Ljk4OSAgICBsLTE5Ljk4NSw0Ny42NzZoLTg4LjIyYy0yLjY2NywwLTQuODUzLDAuODU5LTYuNTY3LDIuNTY4Yy0xLjcwOSwxLjcxMy0yLjU2OCwzLjkwMy0yLjU2OCw2LjU2N3YxOC4yNzQgICAgYzAsMi42NjQsMC44NTUsNC44NTQsMi41NjgsNi41NjRjMS43MTQsMS43MTIsMy45MDQsMi41NjgsNi41NjcsMi41NjhoMjcuNDA2djI3MS44YzAsMTUuODAzLDQuNDczLDI5LjI2NiwxMy40MTgsNDAuMzk4ICAgIGM4Ljk0NywxMS4xMzksMTkuNzAxLDE2LjcwMywzMi4yNjQsMTYuNzAzaDIzNy41NDJjMTIuNTY2LDAsMjMuMzE5LTUuNzU2LDMyLjI2NS0xNy4yNjhjOC45NDUtMTEuNTIsMTMuNDE1LTI1LjE3NCwxMy40MTUtNDAuOTcxICAgIFYxMDkuNjI3aDI3LjQxMWMyLjY2MiwwLDQuODUzLTAuODU2LDYuNTYzLTIuNTY4YzEuNzA4LTEuNzA5LDIuNTctMy45LDIuNTctNi41NjRWODIuMjIxICAgIEM0MjAuMjYsNzkuNTU3LDQxOS4zOTcsNzcuMzY3LDQxNy42ODksNzUuNjU0eiBNMTY5LjMwMSwzOS42NzhjMS4zMzEtMS43MTIsMi45NS0yLjc2Miw0Ljg1My0zLjE0aDkwLjUwNCAgICBjMS45MDMsMC4zODEsMy41MjUsMS40Myw0Ljg1NCwzLjE0bDEzLjcwOSwzMy40MDRIMTU1LjMxMUwxNjkuMzAxLDM5LjY3OHogTTM0Ny4xNzMsMzgwLjI5MWMwLDQuMTg2LTAuNjY0LDguMDQyLTEuOTk5LDExLjU2MSAgICBjLTEuMzM0LDMuNTE4LTIuNzE3LDYuMDg4LTQuMTQxLDcuNzA2Yy0xLjQzMSwxLjYyMi0yLjQyMywyLjQyNy0yLjk5OCwyLjQyN0gxMDAuNDkzYy0wLjU3MSwwLTEuNTY1LTAuODA1LTIuOTk2LTIuNDI3ICAgIGMtMS40MjktMS42MTgtMi44MS00LjE4OC00LjE0My03LjcwNmMtMS4zMzEtMy41MTktMS45OTctNy4zNzktMS45OTctMTEuNTYxVjEwOS42MjdoMjU1LjgxNVYzODAuMjkxeiIgZmlsbD0iI2ZmOWNhZSIvPgoJCTxwYXRoIGQ9Ik0xMzcuMDQsMzQ3LjE3MmgxOC4yNzFjMi42NjcsMCw0Ljg1OC0wLjg1NSw2LjU2Ny0yLjU2N2MxLjcwOS0xLjcxOCwyLjU2OC0zLjkwMSwyLjU2OC02LjU3VjE3My41ODEgICAgYzAtMi42NjMtMC44NTktNC44NTMtMi41NjgtNi41NjdjLTEuNzE0LTEuNzA5LTMuODk5LTIuNTY1LTYuNTY3LTIuNTY1SDEzNy4wNGMtMi42NjcsMC00Ljg1NCwwLjg1NS02LjU2NywyLjU2NSAgICBjLTEuNzExLDEuNzE0LTIuNTY4LDMuOTA0LTIuNTY4LDYuNTY3djE2NC40NTRjMCwyLjY2OSwwLjg1NCw0Ljg1MywyLjU2OCw2LjU3QzEzMi4xODYsMzQ2LjMxNiwxMzQuMzczLDM0Ny4xNzIsMTM3LjA0LDM0Ny4xNzJ6IiBmaWxsPSIjZmY5Y2FlIi8+CgkJPHBhdGggZD0iTTIxMC4xMjksMzQ3LjE3MmgxOC4yNzFjMi42NjYsMCw0Ljg1Ni0wLjg1NSw2LjU2NC0yLjU2N2MxLjcxOC0xLjcxOCwyLjU2OS0zLjkwMSwyLjU2OS02LjU3VjE3My41ODEgICAgYzAtMi42NjMtMC44NTItNC44NTMtMi41NjktNi41NjdjLTEuNzA4LTEuNzA5LTMuODk4LTIuNTY1LTYuNTY0LTIuNTY1aC0xOC4yNzFjLTIuNjY0LDAtNC44NTQsMC44NTUtNi41NjcsMi41NjUgICAgYy0xLjcxNCwxLjcxNC0yLjU2OCwzLjkwNC0yLjU2OCw2LjU2N3YxNjQuNDU0YzAsMi42NjksMC44NTQsNC44NTMsMi41NjgsNi41N0MyMDUuMjc0LDM0Ni4zMTYsMjA3LjQ2NSwzNDcuMTcyLDIxMC4xMjksMzQ3LjE3MnogICAgIiBmaWxsPSIjZmY5Y2FlIi8+CgkJPHBhdGggZD0iTTI4My4yMiwzNDcuMTcyaDE4LjI2OGMyLjY2OSwwLDQuODU5LTAuODU1LDYuNTctMi41NjdjMS43MTEtMS43MTgsMi41NjItMy45MDEsMi41NjItNi41N1YxNzMuNTgxICAgIGMwLTIuNjYzLTAuODUyLTQuODUzLTIuNTYyLTYuNTY3Yy0xLjcxMS0xLjcwOS0zLjkwMS0yLjU2NS02LjU3LTIuNTY1SDI4My4yMmMtMi42NywwLTQuODUzLDAuODU1LTYuNTcxLDIuNTY1ICAgIGMtMS43MTEsMS43MTQtMi41NjYsMy45MDQtMi41NjYsNi41Njd2MTY0LjQ1NGMwLDIuNjY5LDAuODU1LDQuODUzLDIuNTY2LDYuNTdDMjc4LjM2NywzNDYuMzE2LDI4MC41NSwzNDcuMTcyLDI4My4yMiwzNDcuMTcyeiIgZmlsbD0iI2ZmOWNhZSIvPgoJPC9nPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+Cjwvc3ZnPgo=) no-repeat;\n}\n\n/* make nested grid have slightly darker bg take almost all space (need some to tell them apart) so items inside can have similar to external size+margin */\n.grid-stack > .grid-stack-item.grid-stack-sub-grid > .grid-stack-item-content {\n  background: rgba(0,0,0,0.1);\n  inset: 8px 8px;\n}\n.grid-stack.grid-stack-nested {\n  background: none;\n  /* background-color: red; */\n  /* take entire space */\n  position: absolute;\n  inset: 0; /* TODO change top: if you have content in nested grid */\n}\n\n.w-full {\n  width: 100%;\n}\n\n.h-full {\n  height: 100%;\n}\n"
  },
  {
    "path": "react/src/demo/demo.tsx",
    "content": "import { ComponentProps, useEffect, useState } from \"react\";\nimport { GridStackOptions, GridStackWidget } from \"gridstack\";\nimport {\n  ComponentDataType,\n  ComponentMap,\n  GridStackProvider,\n  GridStackRender,\n  GridStackRenderProvider,\n  useGridStackContext,\n} from \"../../lib\";\n// import { GridStackRenderProvider } from \"../../lib/grid-stack-render-provider-single\";\n\nimport \"gridstack/dist/gridstack.css\";\nimport \"./demo.css\";\n\nconst CELL_HEIGHT = 50;\nconst BREAKPOINTS = [\n  { c: 1, w: 700 },\n  { c: 3, w: 850 },\n  { c: 6, w: 950 },\n  { c: 8, w: 1100 },\n];\n\nfunction Text({ content }: { content: string }) {\n  return <div className=\"w-full h-full\">{content}</div>;\n}\n\nconst COMPONENT_MAP: ComponentMap = {\n  Text,\n  // ... other components here\n};\n\n// ! Content must be json string like this:\n// { name: \"Text\", props: { content: \"Item 1\" } }\nconst gridOptions: GridStackOptions = {\n  acceptWidgets: true,\n  columnOpts: {\n    breakpointForWindow: true,\n    breakpoints: BREAKPOINTS,\n    layout: \"moveScale\",\n    columnMax: 12,\n  },\n  margin: 8,\n  cellHeight: CELL_HEIGHT,\n  subGridOpts: {\n    acceptWidgets: true,\n    columnOpts: {\n      breakpoints: BREAKPOINTS,\n      layout: \"moveScale\",\n    },\n    margin: 8,\n    minRow: 2,\n    cellHeight: CELL_HEIGHT,\n  },\n  children: [\n    {\n      id: \"item1\",\n      h: 2,\n      w: 2,\n      x: 0,\n      y: 0,\n      content: JSON.stringify({\n        name: \"Text\",\n        props: { content: \"Item 1\" },\n      } satisfies ComponentDataType<ComponentProps<typeof Text>>), // if need type check\n    },\n    {\n      id: \"item2\",\n      h: 2,\n      w: 2,\n      x: 2,\n      y: 0,\n      content: JSON.stringify({\n        name: \"Text\",\n        props: { content: \"Item 2\" },\n      }),\n    },\n    {\n      id: \"sub-grid-1\",\n      h: 5,\n      sizeToContent: true,\n      subGridOpts: {\n        acceptWidgets: true,\n        cellHeight: CELL_HEIGHT,\n        alwaysShowResizeHandle: false,\n        column: \"auto\",\n        minRow: 2,\n        layout: \"list\",\n        margin: 8,\n        children: [\n          {\n            id: \"sub-grid-1-title\",\n            locked: true,\n            noMove: true,\n            noResize: true,\n            w: 12,\n            x: 0,\n            y: 0,\n            content: JSON.stringify({\n              name: \"Text\",\n              props: { content: \"Sub Grid 1 Title\" },\n            }),\n          },\n          {\n            id: \"item3\",\n            h: 2,\n            w: 2,\n            x: 0,\n            y: 1,\n            content: JSON.stringify({\n              name: \"Text\",\n              props: { content: \"Item 3\" },\n            }),\n          },\n          {\n            id: \"item4\",\n            h: 2,\n            w: 2,\n            x: 2,\n            y: 0,\n            content: JSON.stringify({\n              name: \"Text\",\n              props: { content: \"Item 4\" },\n            }),\n          },\n        ],\n      },\n      w: 12,\n      x: 0,\n      y: 2,\n    },\n  ],\n  lazyLoad: true\n};\n\nexport function GridStackDemo() {\n  // ! Uncontrolled\n  const [initialOptions] = useState(gridOptions);\n  const [initialOptions2] = useState({});\n\n  return (\n    <>\n    <GridStackProvider initialOptions={initialOptions}>\n      <Toolbar />\n        <GridStackRenderProvider>\n        <GridStackRender componentMap={COMPONENT_MAP} />\n      </GridStackRenderProvider>\n      <DebugInfo />\n    </GridStackProvider>\n\n    <GridStackProvider initialOptions={initialOptions2}>\n      <Toolbar />\n        <GridStackRenderProvider>\n        <GridStackRender componentMap={COMPONENT_MAP} />\n      </GridStackRenderProvider>\n      <DebugInfo />\n    </GridStackProvider>\n    </>\n  );\n}\n\nfunction Toolbar() {\n  const { addWidget, addSubGrid } = useGridStackContext();\n\n  return (\n    <div\n      style={{\n        border: \"1px solid gray\",\n        width: \"100%\",\n        padding: \"10px\",\n        marginBottom: \"10px\",\n        display: \"flex\",\n        flexDirection: \"row\",\n        gap: \"10px\",\n      }}\n    >\n      <button\n        onClick={() => {\n          const id = `widget-${Math.random().toString(36).substring(2, 15)}`;\n          \n          addWidget({\n            id,\n            w: 2,\n            h: 2,\n            x: 0,\n            y: 0,\n            content: JSON.stringify({\n              name: \"Text\",\n              props: { content: id },\n            }),\n          });\n        }}\n      >\n        Add Text (2x2)\n      </button>\n\n      <button\n        onClick={() => {\n          const subGridId = `sub-grid-${Math.random().toString(36).substring(2, 15)}`;\n          const widgetId = `widget-${Math.random().toString(36).substring(2, 15)}`;\n\n          addSubGrid({\n            id: subGridId,\n            h: 5,\n            noResize: false,\n            sizeToContent: true,\n            subGridOpts: {\n              acceptWidgets: true,\n              columnOpts: { breakpoints: BREAKPOINTS, layout: \"moveScale\" },\n              margin: 8,\n              minRow: 2,\n              cellHeight: CELL_HEIGHT,\n              children: [\n                {\n                  id: widgetId,\n                  h: 1,\n                  locked: true,\n                  noMove: true,\n                  noResize: true,\n                  w: 12,\n                  x: 0,\n                  y: 0,\n                  content: JSON.stringify({\n                    name: \"Text\",\n                    props: { content: \"Sub Grid 1 Title\" + widgetId },\n                  }),\n                },\n              ],\n            },\n            w: 12,\n            x: 0,\n            y: 0,\n          });\n        }}\n      >\n        Add Sub Grid (12x1)\n      </button>\n    </div>\n  );\n}\n\nfunction DebugInfo() {\n  const { initialOptions, saveOptions } = useGridStackContext();\n\n  const [realtimeOptions, setRealtimeOptions] = useState<\n    GridStackOptions | GridStackWidget[] | undefined\n  >(undefined);\n\n  useEffect(() => {\n    const timer = setInterval(() => {\n      if (saveOptions) {\n        const data = saveOptions();\n        setRealtimeOptions(data);\n      }\n    }, 2000);\n\n    return () => clearInterval(timer);\n  }, [saveOptions]);\n\n  return (\n    <div>\n      <h2>Debug Info</h2>\n      <div\n        style={{\n          display: \"grid\",\n          gap: \"1rem\",\n          gridTemplateColumns: \"repeat(2, 1fr)\",\n        }}\n      >\n        <div>\n          <h3>Initial Options</h3>\n          <pre\n            style={{\n              backgroundColor: \"#f3f4f6\",\n              padding: \"1rem\",\n              borderRadius: \"0.25rem\",\n              overflow: \"auto\",\n            }}\n          >\n            {JSON.stringify(initialOptions, null, 2)}\n          </pre>\n        </div>\n        <div>\n          <h3>Realtime Options (2s refresh)</h3>\n          <pre\n            style={{\n              backgroundColor: \"#f3f4f6\",\n              padding: \"1rem\",\n              borderRadius: \"0.25rem\",\n              overflow: \"auto\",\n            }}\n          >\n            {JSON.stringify(realtimeOptions, null, 2)}\n          </pre>\n        </div>\n      </div>\n    </div>\n  );\n}\n"
  },
  {
    "path": "react/src/main.tsx",
    "content": "\nimport { StrictMode } from 'react'\nimport { createRoot } from 'react-dom/client'\n\nimport 'gridstack/dist/gridstack.css';\n\nimport App from './App.tsx'\n\n\ncreateRoot(document.getElementById('root')!).render(\n  <StrictMode>\n    <App />\n  </StrictMode>,\n)\n"
  },
  {
    "path": "react/src/vite-env.d.ts",
    "content": "/// <reference types=\"vite/client\" />\n"
  },
  {
    "path": "react/tsconfig.app.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2020\",\n    \"useDefineForClassFields\": true,\n    \"lib\": [\"ES2020\", \"DOM\", \"DOM.Iterable\"],\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n\n    /* Bundler mode */\n    \"moduleResolution\": \"bundler\",\n    \"allowImportingTsExtensions\": true,\n    \"isolatedModules\": true,\n    \"moduleDetection\": \"force\",\n    \"noEmit\": true,\n    \"jsx\": \"react-jsx\",\n\n    /* Linting */\n    \"strict\": true,\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n    \"noFallthroughCasesInSwitch\": true\n  },\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "react/tsconfig.app.tsbuildinfo",
    "content": "{\"root\":[\"./src/app.tsx\",\"./src/main.tsx\",\"./src/vite-env.d.ts\",\"./src/demo/demo.tsx\"],\"version\":\"5.6.2\"}"
  },
  {
    "path": "react/tsconfig.json",
    "content": "{\n  \"files\": [],\n  \"references\": [\n    { \"path\": \"./tsconfig.app.json\" },\n    { \"path\": \"./tsconfig.node.json\" }\n  ]\n}\n"
  },
  {
    "path": "react/tsconfig.node.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"lib\": [\"ES2023\"],\n    \"module\": \"ESNext\",\n    \"skipLibCheck\": true,\n\n    /* Bundler mode */\n    \"moduleResolution\": \"bundler\",\n    \"allowImportingTsExtensions\": true,\n    \"isolatedModules\": true,\n    \"moduleDetection\": \"force\",\n    \"noEmit\": true,\n\n    /* Linting */\n    \"strict\": true,\n    \"noUnusedLocals\": true,\n    \"noUnusedParameters\": true,\n    \"noFallthroughCasesInSwitch\": true\n  },\n  \"include\": [\"vite.config.ts\"]\n}\n"
  },
  {
    "path": "react/tsconfig.node.tsbuildinfo",
    "content": "{\"root\":[\"./vite.config.ts\"],\"version\":\"5.6.2\"}"
  },
  {
    "path": "react/vite.config.ts",
    "content": "import { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react-swc'\n\n// https://vitejs.dev/config/\nexport default defineConfig({\n  plugins: [react()],\n  test: {\n    environment: 'jsdom',\n    globals: true,\n  },\n})\n"
  },
  {
    "path": "scripts/generate-docs.js",
    "content": "#!/usr/bin/env node\n\n/**\n * Generic documentation generation script for GridStack.js\n * Generates both HTML and Markdown documentation for the main library and Angular components\n */\n\nconst { execSync } = require('child_process');\nconst fs = require('fs');\nconst path = require('path');\n\n// Configuration\nconst config = {\n  // Main library paths\n  mainLib: {\n    root: '.',\n    typedocConfig: 'typedoc.json',\n    typedocHtmlConfig: 'typedoc.html.json',\n    outputDir: 'doc'\n  },\n  \n  // Angular library paths\n  angular: {\n    root: 'angular',\n    typedocConfig: 'typedoc.json',\n    typedocHtmlConfig: 'typedoc.html.json',\n    outputDir: 'doc'\n  },\n  \n  // Output configuration\n  output: {\n    cleanup: true,\n    verbose: true\n  }\n};\n\n/**\n * Execute a command and handle errors\n * @param {string} command - Command to execute\n * @param {string} cwd - Working directory\n * @param {string} description - Description for logging\n */\nfunction execCommand(command, cwd = '.', description = '') {\n  if (config.output.verbose) {\n    console.log(`\\n📋 ${description || command}`);\n    console.log(`   Working directory: ${cwd}`);\n    console.log(`   Command: ${command}`);\n  }\n  \n  try {\n    const result = execSync(command, { \n      cwd, \n      stdio: config.output.verbose ? 'inherit' : 'pipe',\n      encoding: 'utf8'\n    });\n    \n    if (config.output.verbose) {\n      console.log(`✅ Success`);\n    }\n    \n    return result;\n  } catch (error) {\n    console.error(`❌ Error executing: ${command}`);\n    console.error(`   Working directory: ${cwd}`);\n    console.error(`   Error: ${error.message}`);\n    \n    if (error.stdout) {\n      console.error(`   Stdout: ${error.stdout}`);\n    }\n    if (error.stderr) {\n      console.error(`   Stderr: ${error.stderr}`);\n    }\n    \n    throw error;\n  }\n}\n\n/**\n * Check if a file exists\n * @param {string} filePath - Path to check\n * @returns {boolean}\n */\nfunction fileExists(filePath) {\n  try {\n    return fs.statSync(filePath).isFile();\n  } catch {\n    return false;\n  }\n}\n\n/**\n * Generate documentation for a library\n * @param {Object} libConfig - Library configuration\n * @param {string} libName - Library name for logging\n */\nfunction generateLibraryDocs(libConfig, libName) {\n  const { root, typedocConfig, typedocHtmlConfig } = libConfig;\n  \n  console.log(`\\n🔧 Generating documentation for ${libName}...`);\n  \n  // Check if TypeDoc config files exist\n  const markdownConfigPath = path.join(root, typedocConfig);\n  const htmlConfigPath = path.join(root, typedocHtmlConfig);\n  \n  if (!fileExists(markdownConfigPath)) {\n    console.warn(`⚠️  Markdown config not found: ${markdownConfigPath}`);\n  }\n  \n  if (!fileExists(htmlConfigPath)) {\n    console.warn(`⚠️  HTML config not found: ${htmlConfigPath}`);\n  }\n  \n  // Generate Markdown documentation\n  if (fileExists(markdownConfigPath)) {\n    execCommand(\n      `npx typedoc --options ${typedocConfig}`,\n      root,\n      `Generating Markdown docs for ${libName}`\n    );\n    \n    // For main library, no _media directory cleanup needed since we generate a single file\n    // For Angular library, remove _media directory if it exists\n    if (libName === 'Angular Library') {\n      const mediaPath = path.join(root, libConfig.outputDir, 'api', '_media');\n      if (fs.existsSync(mediaPath)) {\n        execCommand(\n          `rm -rf ${path.join(libConfig.outputDir, 'api', '_media')}`,\n          root,\n          `Removing _media directory for ${libName}`\n        );\n      }\n    }\n  }\n  \n  // Generate HTML documentation\n  if (fileExists(htmlConfigPath)) {\n    execCommand(\n      `npx typedoc --options ${typedocHtmlConfig}`,\n      root,\n      `Generating HTML docs for ${libName}`\n    );\n    \n    // Remove media directory from HTML docs if it exists\n    const htmlMediaPath = path.join(root, libConfig.outputDir, 'html', 'media');\n    if (fs.existsSync(htmlMediaPath)) {\n      execCommand(\n        `rm -rf ${path.join(libConfig.outputDir, 'html', 'media')}`,\n        root,\n        `Removing media directory from HTML docs for ${libName}`\n      );\n    }\n  }\n  \n  console.log(`✅ ${libName} documentation generated successfully`);\n}\n\n/**\n * Run post-processing scripts if they exist\n */\nfunction runPostProcessing() {\n  console.log(`\\n🔧 Running post-processing...`);\n  \n  // Main library post-processing\n  if (fileExists('scripts/reorder-docs.js')) {\n    execCommand(\n      'node scripts/reorder-docs.js',\n      '.',\n      'Reordering Markdown documentation'\n    );\n  }\n  \n  if (fileExists('scripts/reorder-html-docs.js')) {\n    execCommand(\n      'node scripts/reorder-html-docs.js',\n      '.',\n      'Reordering HTML documentation'\n    );\n  }\n  \n  console.log(`✅ Post-processing completed`);\n}\n\n/**\n * Clean up old documentation if requested\n */\nfunction cleanup() {\n  if (!config.output.cleanup) return;\n  \n  console.log(`\\n🧹 Cleaning up old documentation...`);\n  \n  // Clean main library docs (API.md and HTML docs)\n  const mainDocsPath = path.join(config.mainLib.root, config.mainLib.outputDir);\n  if (fs.existsSync(mainDocsPath)) {\n    execCommand(`rm -rf ${mainDocsPath}/classes ${mainDocsPath}/interfaces ${mainDocsPath}/type-aliases ${mainDocsPath}/variables`, '.', 'Cleaning main library markdown docs');\n  }\n  \n  // Clean HTML docs\n  if (fs.existsSync('doc/html')) {\n    execCommand(`rm -rf doc/html`, '.', 'Cleaning main library HTML docs');\n  }\n  \n  // Clean Angular docs\n  const angularDocsPath = path.join(config.angular.root, config.angular.outputDir);\n  if (fs.existsSync(angularDocsPath)) {\n    execCommand(`rm -rf ${angularDocsPath}`, config.angular.root, 'Cleaning Angular library docs');\n  }\n  \n  console.log(`✅ Cleanup completed`);\n}\n\n/**\n * Display help information\n */\nfunction showHelp() {\n  console.log(`\n📚 GridStack Documentation Generator\n\nUsage: node scripts/generate-docs.js [options]\n\nOptions:\n  --main-only       Generate only main library documentation\n  --angular-only    Generate only Angular library documentation\n  --no-cleanup      Skip cleanup of existing documentation\n  --quiet           Reduce output verbosity\n  --help, -h        Show this help message\n\nExamples:\n  node scripts/generate-docs.js                    # Generate all documentation\n  node scripts/generate-docs.js --main-only        # Main library only\n  node scripts/generate-docs.js --angular-only     # Angular library only\n  node scripts/generate-docs.js --no-cleanup       # Keep existing docs\n\nEnvironment:\n  NODE_ENV          Set to 'development' for verbose output\n  `);\n}\n\n/**\n * Parse command line arguments\n */\nfunction parseArgs() {\n  const args = process.argv.slice(2);\n  const options = {\n    mainOnly: false,\n    angularOnly: false,\n    cleanup: true,\n    verbose: process.env.NODE_ENV === 'development'\n  };\n  \n  for (const arg of args) {\n    switch (arg) {\n      case '--main-only':\n        options.mainOnly = true;\n        break;\n      case '--angular-only':\n        options.angularOnly = true;\n        break;\n      case '--no-cleanup':\n        options.cleanup = false;\n        break;\n      case '--quiet':\n        options.verbose = false;\n        break;\n      case '--help':\n      case '-h':\n        showHelp();\n        process.exit(0);\n        break;\n      default:\n        console.warn(`⚠️  Unknown argument: ${arg}`);\n    }\n  }\n  \n  return options;\n}\n\n/**\n * Main execution function\n */\nfunction main() {\n  const options = parseArgs();\n  \n  // Update config with options\n  config.output.cleanup = options.cleanup;\n  config.output.verbose = options.verbose;\n  \n  console.log(`🚀 GridStack Documentation Generator`);\n  console.log(`   Main library: ${!options.angularOnly}`);\n  console.log(`   Angular library: ${!options.mainOnly}`);\n  console.log(`   Cleanup: ${config.output.cleanup}`);\n  console.log(`   Verbose: ${config.output.verbose}`);\n  \n  try {\n    // Cleanup if requested\n    if (config.output.cleanup) {\n      cleanup();\n    }\n    \n    // Generate main library documentation\n    if (!options.angularOnly) {\n      generateLibraryDocs(config.mainLib, 'Main Library');\n    }\n    \n    // Generate Angular library documentation\n    if (!options.mainOnly) {\n      generateLibraryDocs(config.angular, 'Angular Library');\n    }\n    \n    // Run post-processing\n    if (!options.angularOnly) {\n      runPostProcessing();\n    }\n    \n    console.log(`\\n🎉 Documentation generation completed successfully!`);\n    console.log(`\\nGenerated documentation:`);\n    \n    if (!options.angularOnly) {\n      console.log(`   📄 Main Library Markdown: doc/API.md`);\n      console.log(`   🌐 Main Library HTML: doc/html/`);\n    }\n    \n    if (!options.mainOnly) {\n      console.log(`   📄 Angular Library Markdown: angular/doc/api/`);\n      console.log(`   🌐 Angular Library HTML: angular/doc/html/`);\n    }\n    \n  } catch (error) {\n    console.error(`\\n💥 Documentation generation failed!`);\n    console.error(`Error: ${error.message}`);\n    process.exit(1);\n  }\n}\n\n// Run the script\nif (require.main === module) {\n  main();\n}\n\nmodule.exports = {\n  generateLibraryDocs,\n  config\n};\n"
  },
  {
    "path": "scripts/reorder-docs.js",
    "content": "#!/usr/bin/env node\n\nconst fs = require('fs');\nconst path = require('path');\n\nconst docsPath = path.join(__dirname, '../doc/API.md');\n\nif (!fs.existsSync(docsPath)) {\n  console.error('Documentation file not found:', docsPath);\n  process.exit(1);\n}\n\nconst content = fs.readFileSync(docsPath, 'utf8');\n\n// Split content by ### headers to get sections\nconst sections = content.split(/(?=^### )/m);\nconst header = sections[0]; // The initial content before first ###\n\n// Extract class/interface sections\nconst classSections = sections.slice(1);\n\n// Find specific sections we want to prioritize\nconst gridStackSection = classSections.find(s => s.startsWith('### GridStack\\n'));\nconst gridStackEngineSection = classSections.find(s => s.startsWith('### GridStackEngine\\n'));\nconst utilsSection = classSections.find(s => s.startsWith('### Utils\\n'));\nconst gridStackOptionsSection = classSections.find(s => s.startsWith('### GridStackOptions\\n'));\n\n// Remove prioritized sections from the rest\nconst remainingSections = classSections.filter(s => \n  !s.startsWith('### GridStack\\n') && \n  !s.startsWith('### GridStackEngine\\n') && \n  !s.startsWith('### Utils\\n') &&\n  !s.startsWith('### GridStackOptions\\n')\n);\n\n// Extract existing anchor links from the content to preserve TypeDoc's numbering\nconst extractExistingAnchors = (content) => {\n  const anchorMap = new Map();\n  const linkRegex = /\\[([^\\]]+)\\]\\(#([^)]+)\\)/g;\n  let match;\n  \n  while ((match = linkRegex.exec(content)) !== null) {\n    const linkText = match[1];\n    const anchor = match[2];\n    // Map clean title to actual anchor\n    const cleanTitle = linkText.replace(/`/g, '').trim();\n    anchorMap.set(cleanTitle, anchor);\n  }\n  \n  return anchorMap;\n};\n\n// Create table of contents using existing anchors\nconst createToc = (sections, anchorMap) => {\n  let toc = '\\n## Table of Contents\\n\\n';\n  \n  // Add main sections first\n  if (gridStackSection) {\n    toc += '- [GridStack](#gridstack)\\n';\n  }\n  if (gridStackEngineSection) {\n    toc += '- [GridStackEngine](#gridstackengine)\\n';\n  }\n  if (utilsSection) {\n    toc += '- [Utils](#utils)\\n';\n  }\n  if (gridStackOptionsSection) {\n    toc += '- [GridStackOptions](#gridstackoptions)\\n';\n  }\n  \n  // Add other sections using existing anchors when possible\n  sections.forEach(section => {\n    const match = section.match(/^### (.+)$/m);\n    if (match) {\n      const title = match[1];\n      const cleanTitle = title.replace(/`/g, '').trim();\n      \n      // Use existing anchor if found, otherwise generate one\n      let anchor = anchorMap.get(cleanTitle);\n      if (!anchor) {\n        // Fallback anchor generation\n        anchor = title\n          .toLowerCase()\n          .replace(/`/g, '')\n          .replace(/[^a-z0-9\\s]/g, '')\n          .replace(/\\s+/g, '-')\n          .replace(/^-+|-+$/g, '');\n      }\n      \n      toc += `- [${title}](#${anchor})\\n`;\n    }\n  });\n  \n  return toc + '\\n';\n};\n\n// Extract existing anchors from the original content  \nconst anchorMap = extractExistingAnchors(content);\n\n// Rebuild content with desired order\nlet reorderedContent = header;\n\n// Add table of contents\nreorderedContent += createToc(remainingSections, anchorMap);\n\n// Add prioritized sections first with explicit anchors\nif (gridStackSection) {\n  const sectionWithAnchor = gridStackSection.replace(/^### (.+)$/m, '<a id=\"gridstack\"></a>\\n### $1');\n  reorderedContent += sectionWithAnchor;\n}\nif (gridStackEngineSection) {\n  const sectionWithAnchor = gridStackEngineSection.replace(/^### (.+)$/m, '<a id=\"gridstackengine\"></a>\\n### $1');\n  reorderedContent += sectionWithAnchor;\n}\nif (utilsSection) {\n  const sectionWithAnchor = utilsSection.replace(/^### (.+)$/m, '<a id=\"utils\"></a>\\n### $1');\n  reorderedContent += sectionWithAnchor;\n}\nif (gridStackOptionsSection) {\n  const sectionWithAnchor = gridStackOptionsSection.replace(/^### (.+)$/m, '<a id=\"gridstackoptions\"></a>\\n### $1');\n  reorderedContent += sectionWithAnchor;\n}\n\n// Add remaining sections with explicit anchors\nremainingSections.forEach(section => {\n  // Add explicit anchor tags to headers for better compatibility\n  const sectionWithAnchors = section.replace(/^### (.+)$/gm, (match, title) => {\n    const cleanTitle = title.replace(/`/g, '').trim();\n    let anchor = anchorMap.get(cleanTitle);\n    if (!anchor) {\n      anchor = title\n        .toLowerCase()\n        .replace(/`/g, '')\n        .replace(/[^a-z0-9\\s]/g, '')\n        .replace(/\\s+/g, '-')\n        .replace(/^-+|-+$/g, '');\n    }\n    return `<a id=\"${anchor}\"></a>\\n### ${title}`;\n  });\n  \n  reorderedContent += sectionWithAnchors;\n});\n\n// Write the reordered content back\nfs.writeFileSync(docsPath, reorderedContent);\n\nconsole.log('✅ Documentation reordered successfully!');\nconsole.log('Order: GridStack → GridStackEngine → Utils → GridStackOptions → Others');\n"
  },
  {
    "path": "scripts/reorder-html-docs.js",
    "content": "#!/usr/bin/env node\n\nconst fs = require('fs');\nconst path = require('path');\n\nconst docsPath = path.join(__dirname, '../doc/html/index.html');\n\nif (!fs.existsSync(docsPath)) {\n  console.error('HTML documentation file not found:', docsPath);\n  process.exit(1);\n}\n\nconst content = fs.readFileSync(docsPath, 'utf8');\n\n// Function to extract class sections from HTML\nfunction extractClassSections(html) {\n  const sections = [];\n  const classRegex = /<section class=\"tsd-panel tsd-member tsd-kind-class\"[^>]*>([\\s\\S]*?)(?=<section class=\"tsd-panel|$)/g;\n  let match;\n  \n  while ((match = classRegex.exec(html)) !== null) {\n    const sectionContent = match[0];\n    // Extract class name from the section\n    const nameMatch = sectionContent.match(/<h3 class=\"tsd-index-signature\"[^>]*>\\s*<span class=\"tsd-kind-class\">Class<\\/span>\\s+<a href=\"[^\"]*\" class=\"tsd-index-link\">\\s*([^<]+)\\s*<\\/a>/);\n    if (nameMatch) {\n      sections.push({\n        name: nameMatch[1].trim(),\n        content: sectionContent,\n        startIndex: match.index\n      });\n    }\n  }\n  \n  return sections;\n}\n\n// For HTML, we need to work with the TypeDoc generated structure\n// Reorder the main content sections (Classes and Interfaces)\n\nfunction reorderMainContent(html) {\n  // Reorder Classes section\n  const classesRegex = /<details class=\"tsd-panel-group tsd-member-group tsd-accordion\" open><summary class=\"tsd-accordion-summary\" data-key=\"section-Classes\"[^>]*>[\\s\\S]*?<h2>Classes<\\/h2><\\/summary><dl class=\"tsd-member-summaries\">([\\s\\S]*?)<\\/dl><\\/details>/;\n  const classesMatch = html.match(classesRegex);\n  \n  if (classesMatch) {\n    const classesContent = classesMatch[1];\n    \n    // Extract individual class items\n    const classItemRegex = /<dt class=\"tsd-member-summary\"[^>]*>[\\s\\S]*?<\\/dt><dd class=\"tsd-member-summary\"><\\/dd>/g;\n    const classItems = [];\n    let match;\n    \n    while ((match = classItemRegex.exec(classesContent)) !== null) {\n      const item = match[0];\n      // Extract class name\n      const nameMatch = item.match(/<a href=\"[^\"]*\">([^<]+)<\\/a>/);\n      if (nameMatch) {\n        classItems.push({\n          name: nameMatch[1],\n          content: item\n        });\n      }\n    }\n    \n    // Define priority order for classes\n    const classPriorityOrder = ['GridStack', 'GridStackEngine', 'Utils'];\n    \n    // Separate priority classes from others\n    const priorityClasses = [];\n    const otherClasses = [];\n    \n    classItems.forEach(item => {\n      if (classPriorityOrder.includes(item.name)) {\n        priorityClasses.push(item);\n      } else {\n        otherClasses.push(item);\n      }\n    });\n    \n    // Sort priority classes\n    priorityClasses.sort((a, b) => {\n      const aIndex = classPriorityOrder.indexOf(a.name);\n      const bIndex = classPriorityOrder.indexOf(b.name);\n      return aIndex - bIndex;\n    });\n    \n    // Create new classes content\n    const reorderedClasses = [...priorityClasses, ...otherClasses];\n    const newClassesContent = reorderedClasses.map(item => item.content).join('');\n    \n    html = html.replace(classesMatch[0], classesMatch[0].replace(classesContent, newClassesContent));\n  }\n  \n  // Reorder Interfaces section to prioritize GridStackOptions\n  const interfacesRegex = /<details class=\"tsd-panel-group tsd-member-group tsd-accordion\" open><summary class=\"tsd-accordion-summary\" data-key=\"section-Interfaces\"[^>]*>[\\s\\S]*?<h2>Interfaces<\\/h2><\\/summary><dl class=\"tsd-member-summaries\">([\\s\\S]*?)<\\/dl><\\/details>/;\n  const interfacesMatch = html.match(interfacesRegex);\n  \n  if (interfacesMatch) {\n    const interfacesContent = interfacesMatch[1];\n    \n    // Extract individual interface items\n    const interfaceItemRegex = /<dt class=\"tsd-member-summary\"[^>]*>[\\s\\S]*?<\\/dt><dd class=\"tsd-member-summary\"><\\/dd>/g;\n    const interfaceItems = [];\n    let match;\n    \n    while ((match = interfaceItemRegex.exec(interfacesContent)) !== null) {\n      const item = match[0];\n      // Extract interface name\n      const nameMatch = item.match(/<a href=\"[^\"]*\">([^<]+)<\\/a>/);\n      if (nameMatch) {\n        interfaceItems.push({\n          name: nameMatch[1],\n          content: item\n        });\n      }\n    }\n    \n    // Find GridStackOptions and prioritize it\n    const gridStackOptionsItem = interfaceItems.find(item => item.name === 'GridStackOptions');\n    const otherInterfaces = interfaceItems.filter(item => item.name !== 'GridStackOptions');\n    \n    // Create new interfaces content with GridStackOptions first\n    const reorderedInterfaces = gridStackOptionsItem ? [gridStackOptionsItem, ...otherInterfaces] : interfaceItems;\n    const newInterfacesContent = reorderedInterfaces.map(item => item.content).join('');\n    \n    html = html.replace(interfacesMatch[0], interfacesMatch[0].replace(interfacesContent, newInterfacesContent));\n  }\n  \n  return html;\n}\n\nfunction reorderSidebarNavigation(html) {\n  // Also reorder the sidebar navigation to match the main content\n  const sidebarRegex = /<details open class=\"tsd-accordion tsd-page-navigation-section\"><summary class=\"tsd-accordion-summary\" data-key=\"section-Classes\"[^>]*>[\\s\\S]*?<span>Classes<\\/span><\\/summary><div>([\\s\\S]*?)<\\/div><\\/details>/;\n  const sidebarMatch = html.match(sidebarRegex);\n  \n  if (sidebarMatch) {\n    const sidebarContent = sidebarMatch[1];\n    \n    // Extract sidebar items\n    const sidebarItemRegex = /<a href=\"[^\"]*\"[^>]*>[\\s\\S]*?<span>([^<]+)<\\/span><\\/a>/g;\n    const sidebarItems = [];\n    let match;\n    \n    while ((match = sidebarItemRegex.exec(sidebarContent)) !== null) {\n      sidebarItems.push({\n        name: match[1].replace(/<wbr\\/>/g, ''),\n        content: match[0]\n      });\n    }\n    \n    // Reorder sidebar classes\n    const classPriorityOrder = ['GridStack', 'GridStackEngine', 'Utils'];\n    const priorityClasses = [];\n    const otherClasses = [];\n    \n    sidebarItems.forEach(item => {\n      if (classPriorityOrder.includes(item.name)) {\n        priorityClasses.push(item);\n      } else {\n        otherClasses.push(item);\n      }\n    });\n    \n    priorityClasses.sort((a, b) => {\n      const aIndex = classPriorityOrder.indexOf(a.name);\n      const bIndex = classPriorityOrder.indexOf(b.name);\n      return aIndex - bIndex;\n    });\n    \n    const reorderedSidebar = [...priorityClasses, ...otherClasses];\n    const newSidebarContent = reorderedSidebar.map(item => item.content).join('');\n    \n    html = html.replace(sidebarMatch[0], sidebarMatch[0].replace(sidebarContent, newSidebarContent));\n  }\n  \n  return html;\n}\n\n// Update the HTML content\nlet updatedContent = reorderMainContent(content);\nupdatedContent = reorderSidebarNavigation(updatedContent);\n\n// Add a custom note at the top about the ordering\nconst customNote = `\n<!-- Documentation ordered with GridStack → GridStackEngine → GridStackOptions first -->\n`;\n\nupdatedContent = updatedContent.replace('<body>', '<body>' + customNote);\n\n// Write the updated content back\nfs.writeFileSync(docsPath, updatedContent);\n\nconsole.log('✅ HTML documentation navigation reordered successfully!');\nconsole.log('Order: GridStack → GridStackEngine → Utils → GridStackOptions → Others');\n"
  },
  {
    "path": "spec/dd-base-impl-spec.ts",
    "content": "import { DDBaseImplement } from '../src/dd-base-impl';\n\ndescribe('DDBaseImplement', () => {\n  let baseImpl: DDBaseImplement;\n\n  beforeEach(() => {\n    baseImpl = new DDBaseImplement();\n  });\n\n  describe('constructor', () => {\n    it('should create instance with undefined disabled state', () => {\n      expect(baseImpl.disabled).toBeUndefined();\n    });\n  });\n\n  describe('enable/disable', () => {\n    it('should enable when disabled', () => {\n      baseImpl.disable();\n      expect(baseImpl.disabled).toBe(true);\n      \n      baseImpl.enable();\n      \n      expect(baseImpl.disabled).toBe(false);\n    });\n\n    it('should disable when enabled', () => {\n      baseImpl.enable();\n      expect(baseImpl.disabled).toBe(false);\n      \n      baseImpl.disable();\n      \n      expect(baseImpl.disabled).toBe(true);\n    });\n\n    it('should return undefined (no chaining)', () => {\n      expect(baseImpl.enable()).toBeUndefined();\n      expect(baseImpl.disable()).toBeUndefined();\n    });\n  });\n\n  describe('destroy', () => {\n    it('should clean up event register', () => {\n      baseImpl.enable();\n      baseImpl.on('test', () => {});\n      \n      baseImpl.destroy();\n      \n      // Should not throw when trying to trigger events after destroy\n      expect(() => baseImpl.triggerEvent('test', new Event('test'))).not.toThrow();\n    });\n  });\n\n  describe('event handling', () => {\n    beforeEach(() => {\n      baseImpl.enable(); // Need to enable for events to trigger\n    });\n\n    it('should handle on/off events', () => {\n      const callback = vi.fn();\n      \n      baseImpl.on('test', callback);\n      baseImpl.triggerEvent('test', new Event('test'));\n      \n      expect(callback).toHaveBeenCalled();\n    });\n\n    it('should remove event listeners with off', () => {\n      const callback = vi.fn();\n      \n      baseImpl.on('test', callback);\n      baseImpl.off('test');\n      baseImpl.triggerEvent('test', new Event('test'));\n      \n      expect(callback).not.toHaveBeenCalled();\n    });\n\n    it('should only keep last listener for same event', () => {\n      const callback1 = vi.fn();\n      const callback2 = vi.fn();\n      \n      baseImpl.on('test', callback1);\n      baseImpl.on('test', callback2); // This overwrites callback1\n      baseImpl.triggerEvent('test', new Event('test'));\n      \n      expect(callback1).not.toHaveBeenCalled();\n      expect(callback2).toHaveBeenCalled();\n    });\n\n    it('should not trigger events when disabled', () => {\n      const callback = vi.fn();\n      \n      baseImpl.on('test', callback);\n      baseImpl.disable();\n      baseImpl.triggerEvent('test', new Event('test'));\n      \n      expect(callback).not.toHaveBeenCalled();\n    });\n  });\n});\n"
  },
  {
    "path": "spec/dd-droppable-spec.ts",
    "content": "import { DDDroppable } from '../src/dd-droppable';\nimport { DDManager } from '../src/dd-manager';\n\ndescribe('DDDroppable', () => {\n  let element: HTMLElement;\n  let droppable: DDDroppable;\n\n  beforeEach(() => {\n    // Create a test element\n    element = document.createElement('div');\n    element.id = 'test-droppable';\n    element.style.width = '100px';\n    element.style.height = '100px';\n    document.body.appendChild(element);\n  });\n\n  afterEach(() => {\n    // Clean up\n    if (droppable) {\n      droppable.destroy();\n    }\n    if (element.parentNode) {\n      element.parentNode.removeChild(element);\n    }\n    // Clear DDManager state\n    delete DDManager.dragElement;\n    delete DDManager.dropElement;\n  });\n\n  describe('constructor', () => {\n    it('should create a droppable instance with default options', () => {\n      droppable = new DDDroppable(element);\n      \n      expect(droppable).toBeDefined();\n      expect(droppable.el).toBe(element);\n      expect(droppable.option).toEqual({});\n      expect(element.classList.contains('ui-droppable')).toBe(true);\n    });\n\n    it('should create a droppable instance with custom options', () => {\n      const options = {\n        accept: '.draggable-item',\n        drop: vi.fn(),\n        over: vi.fn(),\n        out: vi.fn()\n      };\n      \n      droppable = new DDDroppable(element, options);\n      \n      expect(droppable.option).toBe(options);\n      expect(droppable.accept).toBeDefined();\n    });\n  });\n\n  describe('enable/disable', () => {\n    beforeEach(() => {\n      droppable = new DDDroppable(element);\n    });\n\n    it('should enable droppable functionality', () => {\n      droppable.disable();\n      expect(droppable.disabled).toBe(true);\n      expect(element.classList.contains('ui-droppable-disabled')).toBe(true);\n      \n      droppable.enable();\n      expect(droppable.disabled).toBe(false);\n      expect(element.classList.contains('ui-droppable')).toBe(true);\n      expect(element.classList.contains('ui-droppable-disabled')).toBe(false);\n    });\n\n    it('should disable droppable functionality', () => {\n      expect(droppable.disabled).toBe(false);\n      \n      droppable.disable();\n      expect(droppable.disabled).toBe(true);\n      expect(element.classList.contains('ui-droppable')).toBe(false);\n      expect(element.classList.contains('ui-droppable-disabled')).toBe(true);\n    });\n\n    it('should not enable if already enabled', () => {\n      const spy = vi.spyOn(element.classList, 'add');\n      droppable.enable(); // Already enabled\n      expect(spy).not.toHaveBeenCalled();\n    });\n\n    it('should not disable if already disabled', () => {\n      droppable.disable();\n      const spy = vi.spyOn(element.classList, 'remove');\n      droppable.disable(); // Already disabled\n      expect(spy).not.toHaveBeenCalled();\n    });\n  });\n\n  describe('destroy', () => {\n    it('should clean up droppable instance', () => {\n      droppable = new DDDroppable(element);\n      \n      droppable.destroy();\n      \n      expect(element.classList.contains('ui-droppable')).toBe(false);\n      expect(element.classList.contains('ui-droppable-disabled')).toBe(false);\n      expect(droppable.disabled).toBe(true);\n    });\n  });\n\n  describe('updateOption', () => {\n    beforeEach(() => {\n      droppable = new DDDroppable(element);\n    });\n\n    it('should update options', () => {\n      const newOptions = {\n        accept: '.new-class',\n        drop: vi.fn()\n      };\n      \n      const result = droppable.updateOption(newOptions);\n      \n      expect(result).toBe(droppable);\n      expect(droppable.option.accept).toBe('.new-class');\n      expect(droppable.option.drop).toBe(newOptions.drop);\n    });\n\n    it('should update accept function when accept is a string', () => {\n      droppable.updateOption({ accept: '.test-class' });\n      \n      expect(droppable.accept).toBeDefined();\n      \n      // Test the accept function\n      const testEl = document.createElement('div');\n      testEl.classList.add('test-class');\n      expect(droppable.accept(testEl)).toBe(true);\n      \n      const otherEl = document.createElement('div');\n      expect(droppable.accept(otherEl)).toBe(false);\n    });\n\n    it('should update accept function when accept is a function', () => {\n      const acceptFn = vi.fn().mockReturnValue(true);\n      droppable.updateOption({ accept: acceptFn });\n      \n      expect(droppable.accept).toBe(acceptFn);\n    });\n  });\n\n  describe('mouse events', () => {\n    beforeEach(() => {\n      droppable = new DDDroppable(element, {\n        over: vi.fn(),\n        out: vi.fn(),\n        drop: vi.fn()\n      });\n\n      // Create a mock draggable element\n      const mockDraggable = {\n        el: document.createElement('div'),\n        ui: vi.fn().mockReturnValue({\n          helper: document.createElement('div'),\n          position: { left: 0, top: 0 }\n        })\n      };\n      DDManager.dragElement = mockDraggable as any;\n    });\n\n    describe('_mouseEnter', () => {\n      it('should handle mouse enter when dragging', () => {\n        const event = new MouseEvent('mouseenter', { bubbles: true });\n        const spy = vi.spyOn(event, 'preventDefault');\n        \n        droppable._mouseEnter(event);\n        \n        expect(spy).toHaveBeenCalled();\n        expect(DDManager.dropElement).toBe(droppable);\n        expect(element.classList.contains('ui-droppable-over')).toBe(true);\n        expect(droppable.option.over).toHaveBeenCalled();\n      });\n\n      it('should not handle mouse enter when not dragging', () => {\n        delete DDManager.dragElement;\n        const event = new MouseEvent('mouseenter', { bubbles: true });\n        \n        droppable._mouseEnter(event);\n        \n        expect(DDManager.dropElement).toBeUndefined();\n        expect(element.classList.contains('ui-droppable-over')).toBe(false);\n      });\n\n      it('should not handle mouse enter when element cannot be dropped', () => {\n        droppable.updateOption({ accept: '.not-matching' });\n        const event = new MouseEvent('mouseenter', { bubbles: true });\n        \n        droppable._mouseEnter(event);\n        \n        expect(DDManager.dropElement).toBeUndefined();\n        expect(element.classList.contains('ui-droppable-over')).toBe(false);\n      });\n    });\n\n    describe('_mouseLeave', () => {\n      beforeEach(() => {\n        DDManager.dropElement = droppable;\n        element.classList.add('ui-droppable-over');\n      });\n\n      it('should handle mouse leave when this is the current drop element', () => {\n        const event = new MouseEvent('mouseleave', { bubbles: true });\n        const spy = vi.spyOn(event, 'preventDefault');\n        \n        droppable._mouseLeave(event);\n        \n        expect(spy).toHaveBeenCalled();\n        expect(DDManager.dropElement).toBeUndefined();\n        expect(droppable.option.out).toHaveBeenCalled();\n      });\n\n      it('should not handle mouse leave when not the current drop element', () => {\n        DDManager.dropElement = null as any;\n        const event = new MouseEvent('mouseleave', { bubbles: true });\n        \n        droppable._mouseLeave(event);\n        \n        expect(droppable.option.out).not.toHaveBeenCalled();\n      });\n\n      it('should not handle mouse leave when no drag element', () => {\n        delete DDManager.dragElement;\n        const event = new MouseEvent('mouseleave', { bubbles: true });\n        \n        droppable._mouseLeave(event);\n        \n        expect(droppable.option.out).not.toHaveBeenCalled();\n      });\n    });\n\n    describe('drop', () => {\n      it('should handle drop event', () => {\n        const event = new MouseEvent('mouseup', { bubbles: true });\n        const spy = vi.spyOn(event, 'preventDefault');\n        \n        droppable.drop(event);\n        \n        expect(spy).toHaveBeenCalled();\n        expect(droppable.option.drop).toHaveBeenCalled();\n      });\n    });\n  });\n\n  describe('_canDrop', () => {\n    beforeEach(() => {\n      droppable = new DDDroppable(element);\n    });\n\n    it('should return true when no accept filter is set', () => {\n      const testEl = document.createElement('div');\n      expect(droppable._canDrop(testEl)).toBe(true);\n    });\n\n    it('should return false when element is null', () => {\n      expect(droppable._canDrop(null as any)).toBeFalsy();\n    });\n\n    it('should use accept function when set', () => {\n      const acceptFn = vi.fn().mockReturnValue(false);\n      droppable.accept = acceptFn;\n      \n      const testEl = document.createElement('div');\n      const result = droppable._canDrop(testEl);\n      \n      expect(acceptFn).toHaveBeenCalledWith(testEl);\n      expect(result).toBe(false);\n    });\n  });\n\n  describe('event handling', () => {\n    beforeEach(() => {\n      droppable = new DDDroppable(element);\n    });\n\n    it('should support on/off event methods', () => {\n      const callback = vi.fn();\n      \n      droppable.on('drop', callback);\n      droppable.off('drop');\n      \n      // These methods should exist and not throw\n      expect(typeof droppable.on).toBe('function');\n      expect(typeof droppable.off).toBe('function');\n    });\n  });\n\n  describe('_ui helper', () => {\n    it('should create UI data object', () => {\n      droppable = new DDDroppable(element);\n      \n      const dragEl = document.createElement('div');\n      const mockDraggable = {\n        el: dragEl,\n        ui: vi.fn().mockReturnValue({\n          helper: dragEl,\n          position: { left: 0, top: 0 }\n        })\n      };\n      \n      const result = droppable._ui(mockDraggable as any);\n      \n      expect(result.draggable).toBe(dragEl);\n      expect(result.helper).toBe(dragEl);\n      expect(result.position).toEqual({ left: 0, top: 0 });\n    });\n  });\n});\n"
  },
  {
    "path": "spec/dd-manager-spec.ts",
    "content": "import { DDManager } from '../src/dd-manager';\n\ndescribe('DDManager', () => {\n  afterEach(() => {\n    // Clean up DDManager state\n    delete DDManager.dragElement;\n    delete DDManager.dropElement;\n    delete DDManager.pauseDrag;\n  });\n\n  describe('static properties', () => {\n    it('should have dragElement property', () => {\n      expect(DDManager.dragElement).toBeUndefined();\n      \n      const mockDragElement = {} as any;\n      DDManager.dragElement = mockDragElement;\n      \n      expect(DDManager.dragElement).toBe(mockDragElement);\n    });\n\n    it('should have dropElement property', () => {\n      expect(DDManager.dropElement).toBeUndefined();\n      \n      const mockDropElement = {} as any;\n      DDManager.dropElement = mockDropElement;\n      \n      expect(DDManager.dropElement).toBe(mockDropElement);\n    });\n\n    it('should have pauseDrag property', () => {\n      expect(DDManager.pauseDrag).toBeUndefined();\n      \n      DDManager.pauseDrag = true;\n      expect(DDManager.pauseDrag).toBe(true);\n      \n      DDManager.pauseDrag = 500;\n      expect(DDManager.pauseDrag).toBe(500);\n    });\n  });\n\n  describe('state management', () => {\n    it('should allow setting and clearing drag element', () => {\n      const mockElement = { id: 'test' } as any;\n      \n      DDManager.dragElement = mockElement;\n      expect(DDManager.dragElement).toBe(mockElement);\n      \n      delete DDManager.dragElement;\n      expect(DDManager.dragElement).toBeUndefined();\n    });\n\n    it('should allow setting and clearing drop element', () => {\n      const mockElement = { id: 'test' } as any;\n      \n      DDManager.dropElement = mockElement;\n      expect(DDManager.dropElement).toBe(mockElement);\n      \n      delete DDManager.dropElement;\n      expect(DDManager.dropElement).toBeUndefined();\n    });\n  });\n});\n\n"
  },
  {
    "path": "spec/dd-simple-integration-spec.ts",
    "content": "import { DDDraggable } from '../src/dd-draggable';\nimport { DDDroppable } from '../src/dd-droppable';\nimport { DDResizable } from '../src/dd-resizable';\nimport { DDElement } from '../src/dd-element';\nimport { GridItemHTMLElement } from '../src/types';\n\ndescribe('DD Integration Tests', () => {\n  let element: GridItemHTMLElement;\n\n  beforeEach(() => {\n    element = document.createElement('div') as GridItemHTMLElement;\n    element.style.width = '100px';\n    element.style.height = '100px';\n    element.style.position = 'absolute';\n    document.body.appendChild(element);\n    \n    // Mock gridstackNode\n    element.gridstackNode = {\n      id: 'test-node',\n      x: 0,\n      y: 0,\n      w: 1,\n      h: 1\n    } as any;\n  });\n\n  afterEach(() => {\n    if (element.parentNode) {\n      element.parentNode.removeChild(element);\n    }\n  });\n\n  describe('DDElement', () => {\n    it('should create DDElement instance', () => {\n      const ddElement = DDElement.init(element);\n      \n      expect(ddElement).toBeDefined();\n      expect(ddElement.el).toBe(element);\n    });\n\n    it('should return same instance on multiple init calls', () => {\n      const ddElement1 = DDElement.init(element);\n      const ddElement2 = DDElement.init(element);\n      \n      expect(ddElement1).toBe(ddElement2);\n    });\n\n    it('should setup draggable', () => {\n      const ddElement = DDElement.init(element);\n      \n      ddElement.setupDraggable({ handle: '.drag-handle' });\n      \n      expect(ddElement.ddDraggable).toBeDefined();\n    });\n\n    it('should setup droppable', () => {\n      const ddElement = DDElement.init(element);\n      \n      ddElement.setupDroppable({ accept: '.draggable' });\n      \n      expect(ddElement.ddDroppable).toBeDefined();\n    });\n\n    it('should setup resizable with default handles', () => {\n      const ddElement = DDElement.init(element);\n      \n      ddElement.setupResizable({ handles: 'se' });\n      \n      expect(ddElement.ddResizable).toBeDefined();\n    });\n\n    it('should clean up components', () => {\n      const ddElement = DDElement.init(element);\n      \n      ddElement.setupDraggable({});\n      ddElement.setupDroppable({});\n      ddElement.setupResizable({ handles: 'se' });\n      \n      expect(ddElement.ddDraggable).toBeDefined();\n      expect(ddElement.ddDroppable).toBeDefined();\n      expect(ddElement.ddResizable).toBeDefined();\n      \n      ddElement.cleanDraggable();\n      ddElement.cleanDroppable();\n      ddElement.cleanResizable();\n      \n      expect(ddElement.ddDraggable).toBeUndefined();\n      expect(ddElement.ddDroppable).toBeUndefined();\n      expect(ddElement.ddResizable).toBeUndefined();\n    });\n  });\n\n  describe('DDDraggable basic functionality', () => {\n    it('should create draggable instance', () => {\n      const draggable = new DDDraggable(element);\n      \n      expect(draggable).toBeDefined();\n      expect(draggable.el).toBe(element);\n      expect(draggable.disabled).toBe(false);\n      \n      draggable.destroy();\n    });\n\n    it('should enable/disable draggable', () => {\n      const draggable = new DDDraggable(element);\n      \n      draggable.disable();\n      expect(draggable.disabled).toBe(true);\n      \n      draggable.enable();\n      expect(draggable.disabled).toBe(false);\n      \n      draggable.destroy();\n    });\n\n    it('should update options', () => {\n      const draggable = new DDDraggable(element);\n      \n      const result = draggable.updateOption({ handle: '.new-handle' });\n      \n      expect(result).toBe(draggable);\n      expect(draggable.option.handle).toBe('.new-handle');\n      \n      draggable.destroy();\n    });\n  });\n\n  describe('DDDroppable basic functionality', () => {\n    it('should create droppable instance', () => {\n      const droppable = new DDDroppable(element);\n      \n      expect(droppable).toBeDefined();\n      expect(droppable.el).toBe(element);\n      expect(droppable.disabled).toBe(false);\n      expect(element.classList.contains('ui-droppable')).toBe(true);\n      \n      droppable.destroy();\n    });\n\n    it('should enable/disable droppable', () => {\n      const droppable = new DDDroppable(element);\n      \n      droppable.disable();\n      expect(droppable.disabled).toBe(true);\n      expect(element.classList.contains('ui-droppable-disabled')).toBe(true);\n      \n      droppable.enable();\n      expect(droppable.disabled).toBe(false);\n      expect(element.classList.contains('ui-droppable')).toBe(true);\n      \n      droppable.destroy();\n    });\n\n    it('should update options', () => {\n      const droppable = new DDDroppable(element);\n      \n      const result = droppable.updateOption({ accept: '.new-class' });\n      \n      expect(result).toBe(droppable);\n      expect(droppable.option.accept).toBe('.new-class');\n      \n      droppable.destroy();\n    });\n\n    it('should handle accept function', () => {\n      const droppable = new DDDroppable(element);\n      \n      droppable.updateOption({ accept: '.test-class' });\n      \n      const testEl = document.createElement('div');\n      testEl.classList.add('test-class');\n      expect(droppable._canDrop(testEl)).toBe(true);\n      \n      const otherEl = document.createElement('div');\n      expect(droppable._canDrop(otherEl)).toBe(false);\n      \n      droppable.destroy();\n    });\n  });\n\n  describe('DDResizable basic functionality', () => {\n    it('should create resizable instance with handles', () => {\n      const resizable = new DDResizable(element, { handles: 'se' });\n      \n      expect(resizable).toBeDefined();\n      expect(resizable.el).toBe(element);\n      expect(resizable.disabled).toBe(false);\n      // Note: ui-resizable class is added by enable() which is called in constructor\n      // but the class might not be added immediately in test environment\n      \n      resizable.destroy();\n    });\n\n    it('should enable/disable resizable', () => {\n      const resizable = new DDResizable(element, { handles: 'se' });\n      \n      resizable.disable();\n      expect(resizable.disabled).toBe(true);\n      expect(element.classList.contains('ui-resizable-disabled')).toBe(true);\n      \n      resizable.enable();\n      expect(resizable.disabled).toBe(false);\n      expect(element.classList.contains('ui-resizable-disabled')).toBe(false);\n      \n      resizable.destroy();\n    });\n\n    it('should update options', () => {\n      const resizable = new DDResizable(element, { handles: 'se' });\n      \n      const result = resizable.updateOption({ handles: 'n,s,e,w' });\n      \n      expect(result).toBe(resizable);\n      expect(resizable.option.handles).toBe('n,s,e,w');\n      \n      resizable.destroy();\n    });\n\n    it('should create resize handles', () => {\n      const resizable = new DDResizable(element, { handles: 'se,nw' });\n      \n      const seHandle = element.querySelector('.ui-resizable-se');\n      const nwHandle = element.querySelector('.ui-resizable-nw');\n      \n      expect(seHandle).toBeTruthy();\n      expect(nwHandle).toBeTruthy();\n      \n      resizable.destroy();\n    });\n  });\n\n  describe('Event handling', () => {\n    it('should support event listeners on DDElement', () => {\n      const ddElement = DDElement.init(element);\n      const callback = vi.fn();\n      \n      ddElement.setupDraggable({});\n      ddElement.on('dragstart', callback);\n      ddElement.off('dragstart');\n      \n      // Should not throw\n      expect(typeof ddElement.on).toBe('function');\n      expect(typeof ddElement.off).toBe('function');\n      \n      ddElement.cleanDraggable();\n    });\n  });\n});\n"
  },
  {
    "path": "spec/dd-touch-spec.ts",
    "content": "import { \n  isTouch, \n  touchstart, \n  touchmove, \n  touchend, \n  pointerdown, \n  pointerenter, \n  pointerleave \n} from '../src/dd-touch';\nimport { DDManager } from '../src/dd-manager';\nimport { Utils } from '../src/utils';\n\n// Mock Utils.simulateMouseEvent\nvi.mock('../src/utils', () => ({\n  Utils: {\n    simulateMouseEvent: vi.fn()\n  }\n}));\n\n// Mock DDManager\nvi.mock('../src/dd-manager', () => ({\n  DDManager: {\n    dragElement: null\n  }\n}));\n\n// Helper function to create mock TouchList\nfunction createMockTouchList(touches: Touch[]): TouchList {\n  const touchList = {\n    length: touches.length,\n    item: (index: number) => touches[index] || null,\n    ...touches\n  };\n  return touchList as TouchList;\n}\n\n// Helper function to create mock TouchEvent\nfunction createMockTouchEvent(type: string, touches: Touch[], options: Partial<TouchEvent> = {}): TouchEvent {\n  const touchList = createMockTouchList(touches);\n  const changedTouchList = options.changedTouches ? \n    createMockTouchList(options.changedTouches as Touch[]) : touchList;\n  \n  const mockEvent = {\n    touches: touchList,\n    changedTouches: changedTouchList,\n    targetTouches: touchList,\n    preventDefault: vi.fn(),\n    stopPropagation: vi.fn(),\n    cancelable: true,\n    type,\n    target: document.createElement('div'),\n    currentTarget: document.createElement('div'),\n    bubbles: true,\n    composed: false,\n    defaultPrevented: false,\n    eventPhase: Event.AT_TARGET,\n    isTrusted: true,\n    timeStamp: Date.now(),\n    altKey: false,\n    ctrlKey: false,\n    metaKey: false,\n    shiftKey: false,\n    detail: 0,\n    view: window,\n    which: 0,\n    ...options\n  };\n  return mockEvent as TouchEvent;\n}\n\n// Helper function to create mock PointerEvent\nfunction createMockPointerEvent(type: string, pointerType: string, options: Partial<PointerEvent> = {}): PointerEvent {\n  const mockEvent = {\n    pointerId: 1,\n    pointerType,\n    target: document.createElement('div'),\n    preventDefault: vi.fn(),\n    stopPropagation: vi.fn(),\n    cancelable: true,\n    type,\n    currentTarget: document.createElement('div'),\n    bubbles: true,\n    composed: false,\n    defaultPrevented: false,\n    eventPhase: Event.AT_TARGET,\n    isTrusted: true,\n    timeStamp: Date.now(),\n    clientX: 100,\n    clientY: 200,\n    pageX: 100,\n    pageY: 200,\n    screenX: 100,\n    screenY: 200,\n    button: 0,\n    buttons: 1,\n    ctrlKey: false,\n    shiftKey: false,\n    altKey: false,\n    metaKey: false,\n    width: 1,\n    height: 1,\n    pressure: 0.5,\n    tangentialPressure: 0,\n    tiltX: 0,\n    tiltY: 0,\n    twist: 0,\n    isPrimary: true,\n    detail: 0,\n    view: window,\n    which: 0,\n    getCoalescedEvents: vi.fn(() => []),\n    getPredictedEvents: vi.fn(() => []),\n    movementX: 0,\n    movementY: 0,\n    offsetX: 0,\n    offsetY: 0,\n    relatedTarget: null,\n    ...options\n  };\n  return mockEvent as PointerEvent;\n}\n\ndescribe('dd-touch', () => {\n  let mockUtils: any;\n  let mockDDManager: any;\n\n  beforeEach(() => {\n    mockUtils = vi.mocked(Utils);\n    mockDDManager = vi.mocked(DDManager);\n    \n    // Reset mocks\n    mockUtils.simulateMouseEvent.mockClear();\n    mockDDManager.dragElement = null;\n    \n    // Mock window.clearTimeout and setTimeout\n    vi.spyOn(window, 'clearTimeout');\n    vi.spyOn(window, 'setTimeout').mockImplementation((callback: Function, delay: number) => {\n      return setTimeout(callback, delay) as any;\n    });\n    \n    // Reset DDTouch state by calling touchend to reset touchHandled flag\n    // This is a workaround since we can't access DDTouch directly\n    const resetTouch = {\n      pageX: 0, pageY: 0, clientX: 0, clientY: 0, screenX: 0, screenY: 0,\n      identifier: 0, target: document.createElement('div'),\n      radiusX: 0, radiusY: 0, rotationAngle: 0, force: 0\n    } as Touch;\n    const resetEvent = createMockTouchEvent('touchend', [], { changedTouches: [resetTouch] });\n    \n    // Call touchstart then touchend to reset state\n    const startEvent = createMockTouchEvent('touchstart', [resetTouch]);\n    touchstart(startEvent);\n    touchend(resetEvent);\n    \n    // Clear any calls made during reset\n    mockUtils.simulateMouseEvent.mockClear();\n  });\n\n  afterEach(() => {\n    vi.restoreAllMocks();\n  });\n\n  describe('isTouch detection', () => {\n    it('should be a boolean value', () => {\n      expect(typeof isTouch).toBe('boolean');\n    });\n\n    it('should detect touch support in current environment', () => {\n      // Since we're in jsdom, isTouch should be false unless touch APIs are mocked\n      // This test validates that the detection logic runs without errors\n      expect(isTouch).toBeDefined();\n    });\n  });\n\n  describe('touchstart', () => {\n    let mockTouch: Touch;\n\n    beforeEach(() => {\n      mockTouch = {\n        pageX: 100,\n        pageY: 200,\n        clientX: 100,\n        clientY: 200,\n        screenX: 100,\n        screenY: 200,\n        identifier: 1,\n        target: document.createElement('div'),\n        radiusX: 10,\n        radiusY: 10,\n        rotationAngle: 0,\n        force: 1\n      } as Touch;\n    });\n\n    it('should simulate mousedown for single touch', () => {\n      const mockTouchEvent = createMockTouchEvent('touchstart', [mockTouch]);\n\n      touchstart(mockTouchEvent);\n\n      expect(mockUtils.simulateMouseEvent).toHaveBeenCalledWith(mockTouch, 'mousedown');\n    });\n\n    it('should prevent default on cancelable events', () => {\n      const mockTouchEvent = createMockTouchEvent('touchstart', [mockTouch], { cancelable: true });\n\n      touchstart(mockTouchEvent);\n\n      expect(mockTouchEvent.preventDefault).toHaveBeenCalled();\n    });\n\n    it('should not prevent default on non-cancelable events', () => {\n      const mockTouchEvent = createMockTouchEvent('touchstart', [mockTouch], { cancelable: false });\n\n      touchstart(mockTouchEvent);\n\n      expect(mockTouchEvent.preventDefault).not.toHaveBeenCalled();\n    });\n\n    it('should ignore multi-touch events', () => {\n      const secondTouch = { ...mockTouch, identifier: 2 };\n      const mockTouchEvent = createMockTouchEvent('touchstart', [mockTouch, secondTouch]);\n\n      touchstart(mockTouchEvent);\n\n      expect(mockUtils.simulateMouseEvent).not.toHaveBeenCalled();\n    });\n  });\n\n  describe('touchmove', () => {\n    let mockTouch: Touch;\n\n    beforeEach(() => {\n      mockTouch = {\n        pageX: 150,\n        pageY: 250,\n        clientX: 150,\n        clientY: 250,\n        screenX: 150,\n        screenY: 250,\n        identifier: 1,\n        target: document.createElement('div'),\n        radiusX: 10,\n        radiusY: 10,\n        rotationAngle: 0,\n        force: 1\n      } as Touch;\n    });\n\n    it('should simulate mousemove for single touch when touch is handled', () => {\n      // First call touchstart to set DDTouch.touchHandled = true\n      const startEvent = createMockTouchEvent('touchstart', [mockTouch]);\n      touchstart(startEvent);\n      \n      mockUtils.simulateMouseEvent.mockClear(); // Clear previous calls\n      \n      const mockTouchEvent = createMockTouchEvent('touchmove', [mockTouch]);\n      touchmove(mockTouchEvent);\n\n      expect(mockUtils.simulateMouseEvent).toHaveBeenCalledWith(mockTouch, 'mousemove');\n    });\n\n    it('should ignore touchmove when touch is not handled', () => {\n      // Don't call touchstart first, so DDTouch.touchHandled remains false\n      const mockTouchEvent = createMockTouchEvent('touchmove', [mockTouch]);\n\n      touchmove(mockTouchEvent);\n\n      expect(mockUtils.simulateMouseEvent).not.toHaveBeenCalled();\n    });\n\n    it('should ignore multi-touch events', () => {\n      // First call touchstart to set DDTouch.touchHandled = true\n      const startEvent = createMockTouchEvent('touchstart', [mockTouch]);\n      touchstart(startEvent);\n      \n      mockUtils.simulateMouseEvent.mockClear(); // Clear previous calls\n      \n      const secondTouch = { ...mockTouch, identifier: 2 };\n      const mockTouchEvent = createMockTouchEvent('touchmove', [mockTouch, secondTouch]);\n\n      touchmove(mockTouchEvent);\n\n      expect(mockUtils.simulateMouseEvent).not.toHaveBeenCalled();\n    });\n  });\n\n  describe('touchend', () => {\n    let mockTouch: Touch;\n\n    beforeEach(() => {\n      mockTouch = {\n        pageX: 200,\n        pageY: 300,\n        clientX: 200,\n        clientY: 300,\n        screenX: 200,\n        screenY: 300,\n        identifier: 1,\n        target: document.createElement('div'),\n        radiusX: 10,\n        radiusY: 10,\n        rotationAngle: 0,\n        force: 1\n      } as Touch;\n    });\n\n    it('should simulate mouseup when touch is handled', () => {\n      // First call touchstart to set DDTouch.touchHandled = true\n      const startEvent = createMockTouchEvent('touchstart', [mockTouch]);\n      touchstart(startEvent);\n      \n      mockUtils.simulateMouseEvent.mockClear(); // Clear previous calls\n      \n      const mockTouchEvent = createMockTouchEvent('touchend', [], { changedTouches: [mockTouch] });\n      touchend(mockTouchEvent);\n\n      expect(mockUtils.simulateMouseEvent).toHaveBeenCalledWith(mockTouch, 'mouseup');\n    });\n\n    it('should simulate click when not dragging', () => {\n      // First call touchstart to set DDTouch.touchHandled = true\n      const startEvent = createMockTouchEvent('touchstart', [mockTouch]);\n      touchstart(startEvent);\n      \n      mockUtils.simulateMouseEvent.mockClear(); // Clear previous calls\n      mockDDManager.dragElement = null; // Not dragging\n      \n      const mockTouchEvent = createMockTouchEvent('touchend', [], { changedTouches: [mockTouch] });\n      touchend(mockTouchEvent);\n\n      expect(mockUtils.simulateMouseEvent).toHaveBeenCalledWith(mockTouch, 'mouseup');\n      expect(mockUtils.simulateMouseEvent).toHaveBeenCalledWith(mockTouch, 'click');\n    });\n\n    it('should not simulate click when dragging', () => {\n      // First call touchstart to set DDTouch.touchHandled = true\n      const startEvent = createMockTouchEvent('touchstart', [mockTouch]);\n      touchstart(startEvent);\n      \n      mockUtils.simulateMouseEvent.mockClear(); // Clear previous calls\n      mockDDManager.dragElement = {}; // Dragging\n      \n      const mockTouchEvent = createMockTouchEvent('touchend', [], { changedTouches: [mockTouch] });\n      touchend(mockTouchEvent);\n\n      expect(mockUtils.simulateMouseEvent).toHaveBeenCalledWith(mockTouch, 'mouseup');\n      expect(mockUtils.simulateMouseEvent).not.toHaveBeenCalledWith(mockTouch, 'click');\n    });\n\n    it('should ignore touchend when touch is not handled', () => {\n      // Don't call touchstart first, so DDTouch.touchHandled remains false\n      const mockTouchEvent = createMockTouchEvent('touchend', [], { changedTouches: [mockTouch] });\n      touchend(mockTouchEvent);\n\n      expect(mockUtils.simulateMouseEvent).not.toHaveBeenCalled();\n    });\n\n    it('should clear pointerLeaveTimeout when it exists', () => {\n      // First set up a pointerleave timeout\n      mockDDManager.dragElement = {};\n      const pointerEvent = createMockPointerEvent('pointerleave', 'touch');\n      \n      let timeoutId: number;\n      vi.mocked(window.setTimeout).mockImplementation((callback: Function, delay: number) => {\n        timeoutId = 123;\n        return timeoutId as any;\n      });\n      \n      pointerleave(pointerEvent);\n      \n      // Now call touchstart and touchend to trigger the timeout clearing\n      const startEvent = createMockTouchEvent('touchstart', [mockTouch]);\n      touchstart(startEvent);\n      \n      mockUtils.simulateMouseEvent.mockClear();\n      \n      const mockTouchEvent = createMockTouchEvent('touchend', [], { changedTouches: [mockTouch] });\n      touchend(mockTouchEvent);\n\n      expect(window.clearTimeout).toHaveBeenCalledWith(123);\n    });\n  });\n\n  describe('pointerdown', () => {\n    let mockElement: HTMLElement;\n\n    beforeEach(() => {\n      mockElement = document.createElement('div');\n      mockElement.releasePointerCapture = vi.fn();\n    });\n\n    it('should release pointer capture for touch events', () => {\n      const mockPointerEvent = createMockPointerEvent('pointerdown', 'touch', { target: mockElement });\n\n      pointerdown(mockPointerEvent);\n\n      expect(mockElement.releasePointerCapture).toHaveBeenCalledWith(1);\n    });\n\n    it('should release pointer capture for pen events', () => {\n      const mockPointerEvent = createMockPointerEvent('pointerdown', 'pen', { target: mockElement });\n\n      pointerdown(mockPointerEvent);\n\n      expect(mockElement.releasePointerCapture).toHaveBeenCalledWith(1);\n    });\n\n    it('should not release pointer capture for mouse events', () => {\n      const mockPointerEvent = createMockPointerEvent('pointerdown', 'mouse', { target: mockElement });\n\n      pointerdown(mockPointerEvent);\n\n      expect(mockElement.releasePointerCapture).not.toHaveBeenCalled();\n    });\n  });\n\n  describe('pointerenter', () => {\n    it('should ignore pointerenter when no drag element', () => {\n      mockDDManager.dragElement = null;\n      const mockPointerEvent = createMockPointerEvent('pointerenter', 'touch');\n\n      pointerenter(mockPointerEvent);\n\n      expect(mockUtils.simulateMouseEvent).not.toHaveBeenCalled();\n    });\n\n    it('should ignore pointerenter for mouse events', () => {\n      mockDDManager.dragElement = {};\n      const mockPointerEvent = createMockPointerEvent('pointerenter', 'mouse');\n\n      pointerenter(mockPointerEvent);\n\n      expect(mockUtils.simulateMouseEvent).not.toHaveBeenCalled();\n    });\n\n    it('should simulate mouseenter for touch events when dragging', () => {\n      mockDDManager.dragElement = {};\n      const mockPointerEvent = createMockPointerEvent('pointerenter', 'touch');\n\n      pointerenter(mockPointerEvent);\n\n      expect(mockUtils.simulateMouseEvent).toHaveBeenCalledWith(mockPointerEvent, 'mouseenter');\n    });\n\n    it('should simulate mouseenter for pen events when dragging', () => {\n      mockDDManager.dragElement = {};\n      const mockPointerEvent = createMockPointerEvent('pointerenter', 'pen');\n\n      pointerenter(mockPointerEvent);\n\n      expect(mockUtils.simulateMouseEvent).toHaveBeenCalledWith(mockPointerEvent, 'mouseenter');\n    });\n\n    it('should prevent default on cancelable pointer events', () => {\n      mockDDManager.dragElement = {};\n      const mockPointerEvent = createMockPointerEvent('pointerenter', 'touch', { cancelable: true });\n\n      pointerenter(mockPointerEvent);\n\n      expect(mockPointerEvent.preventDefault).toHaveBeenCalled();\n    });\n\n    it('should not prevent default on non-cancelable pointer events', () => {\n      mockDDManager.dragElement = {};\n      const mockPointerEvent = createMockPointerEvent('pointerenter', 'touch', { cancelable: false });\n\n      pointerenter(mockPointerEvent);\n\n      expect(mockPointerEvent.preventDefault).not.toHaveBeenCalled();\n    });\n  });\n\n  describe('pointerleave', () => {\n    it('should ignore pointerleave when no drag element', () => {\n      mockDDManager.dragElement = null;\n      const mockPointerEvent = createMockPointerEvent('pointerleave', 'touch');\n\n      pointerleave(mockPointerEvent);\n\n      expect(window.setTimeout).not.toHaveBeenCalled();\n      expect(mockUtils.simulateMouseEvent).not.toHaveBeenCalled();\n    });\n\n    it('should ignore pointerleave for mouse events', () => {\n      mockDDManager.dragElement = {};\n      const mockPointerEvent = createMockPointerEvent('pointerleave', 'mouse');\n\n      pointerleave(mockPointerEvent);\n\n      expect(window.setTimeout).not.toHaveBeenCalled();\n      expect(mockUtils.simulateMouseEvent).not.toHaveBeenCalled();\n    });\n\n    it('should delay mouseleave simulation for touch events when dragging', () => {\n      mockDDManager.dragElement = {};\n      const mockPointerEvent = createMockPointerEvent('pointerleave', 'touch');\n      \n      // Mock setTimeout to capture the callback\n      let timeoutCallback: Function;\n      vi.mocked(window.setTimeout).mockImplementation((callback: Function, delay: number) => {\n        timeoutCallback = callback;\n        return 123 as any;\n      });\n\n      pointerleave(mockPointerEvent);\n\n      expect(window.setTimeout).toHaveBeenCalledWith(expect.any(Function), 10);\n      \n      // Execute the timeout callback\n      timeoutCallback!();\n      \n      expect(mockUtils.simulateMouseEvent).toHaveBeenCalledWith(mockPointerEvent, 'mouseleave');\n    });\n  });\n});"
  },
  {
    "path": "spec/e2e/gridstack-html-spec.js",
    "content": "describe('gridstack.js with height', function() {\n  beforeAll(function() {\n    browser.ignoreSynchronization = true;\n  });\n\n  beforeEach(function() {\n    browser.get('http://localhost:8080/spec/e2e/html/gridstack-with-height.html');\n  });\n\n  it('shouldn\\'t throw exception when dragging widget outside the grid', function() {\n    let widget = element(by.id('item-1'));\n    let gridContainer = element(by.id('grid'));\n\n    browser.actions()\n      .mouseDown(widget, {x: 20, y: 20})\n      .mouseMove(gridContainer, {x: 300, y: 20})\n      .mouseUp()\n      .perform();\n\n    browser.manage().logs().get('browser').then(function(browserLog) {\n      expect(browserLog.length).toEqual(0);\n    });\n  });\n});\n\ndescribe('grid elements with no x,y positions', function() {\n  beforeAll(function() {\n    browser.ignoreSynchronization = true;\n  });\n\n  beforeEach(function() {\n    browser.get('http://localhost:8080/spec/e2e/html/1017-items-no-x-y-for-autoPosition.html');\n  });\n\n  it('should match positions in order 5,1,2,4,3', function() {\n    // TBD\n    // expect(null).not.toBeNull();\n  });\n});"
  },
  {
    "path": "spec/e2e/html/1017-items-no-x-y-for-autoPosition.html",
    "content": "<!-- \n  grid items have no x,y position, just size. Used to come up with wrong size and overlap. https://github.com/gridstack/gridstack.js/issues/1017\n  Now, will have element 5 (position first with small x,y), 1,2,4, then 3 (too big to fit)\n-->\n<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n  <style type=\"text/css\">\n    .upper .grid-stack-item-content {\n      background: blue;\n    }\n  </style>\n</head>\n\n<body>\n  <br>\n  <div class=\"grid-stack\">\n    <div class=\"grid-stack-item upper\" gs-w=\"2\" gs-h=\"2\" gs-id=\"1\">\n      <div class=\"grid-stack-item-content\">item 1</div>\n    </div>\n    <div class=\"grid-stack-item\" gs-w=\"3\" gs-h=\"2\" gs-id=\"2\">\n      <div class=\"grid-stack-item-content\">item 2</div>\n    </div>\n    <div class=\"grid-stack-item\" gs-w=\"9\" gs-h=\"1\" gs-id=\"3\">\n      <div class=\"grid-stack-item-content\">item 3 too big to fit, so next row</div>\n    </div>\n    <div class=\"grid-stack-item\" gs-w=\"3\" gs-h=\"1\" gs-id=\"4\">\n      <div class=\"grid-stack-item-content\">item 4</div>\n    </div>\n    <div class=\"grid-stack-item\" gs-x=\"1\" gs-y=\"1\" gs-w=\"1\" gs-h=\"1\" gs-id=\"5\">\n      <div class=\"grid-stack-item-content\">item 5 first</div>\n    </div>\n  </div>\n\n  <script type=\"text/javascript\">\n    let options = {\n      cellHeight: 80,\n      margin: 5,\n      float: true\n    };\n    GridStack.init(options);\n  </script>\n</body>\n\n</html>"
  },
  {
    "path": "spec/e2e/html/1102-button-between-grids.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>lose functionality</title>\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>lose functionality when dragged</h1>\n    <br/>\n    <div class=\"grid-stack\" id=\"right-grid\">\n      <div class=\"grid-stack-item\">\n        <div class=\"grid-stack-item-content\" onclick=\"alert('1')\">button1</div>\n      </div>\n    </div>\n     <br/>\n    <br/>\n    <div class=\"grid-stack\" id=\"left-grid\">\n      <div class=\"grid-stack-item\">\n        <div class=\"grid-stack-item-content\" onclick=\"alert('2')\">button2</div>\n      </div>\n    </div>\n  </div>\n\n  <script type=\"text/javascript\">\n    GridStack.initAll({acceptWidgets: true});\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1142_change_event_missing.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>1142 demo</title>\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"https://cdn.jsdelivr.net/npm/gridstack@5.1.1/dist/gridstack-jq.js\"></script>\n</head>\n<body>\n  <h1>JQ test case with click to remove</h1>\n  <div class=\"grid-stack\">\n    <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"0\" gs-w=\"3\" gs-h=\"1\"><div class=\"grid-stack-item-content\">1 click to delete</div></div>\n    <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"1\" gs-w=\"3\" gs-h=\"1\"><div class=\"grid-stack-item-content\">2 missing change event</div></div>\n    <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"2\" gs-w=\"1\" gs-h=\"1\"><div class=\"grid-stack-item-content\">3</div></div>\n    <div class=\"grid-stack-item\" gs-x=\"4\" gs-y=\"0\" gs-w=\"1\" gs-h=\"1\"><div class=\"grid-stack-item-content\">4</div></div>\n  </div>\n  \n<script type=\"text/javascript\">\n  let grid = GridStack.init({float: false});\n\n  grid.on('added removed change', function(e, items) {\n    let str = '';\n    items.forEach(function(item) { str += ' (x,y)=' + item.x + ',' + item.y; });\n    console.log(e.type + ' ' + items.length + ' items:' + str );\n  });\n\n  $('.grid-stack .grid-stack-item').click(function(e) {\n    let item = $(e.currentTarget).closest('.grid-stack-item');\n    grid.removeWidget(item.get(0));\n  });\n</script>\n</body>\n</html>"
  },
  {
    "path": "spec/e2e/html/1143_nested_acceptWidget_types.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>#1143 test</title>\n\n  <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css\">\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n  <style type=\"text/css\">\n    .grid-stack-item-removing {\n      opacity: 0.8;\n      filter: blur(5px);\n    }\n    .outer .grid-stack-item-content {\n      background-color: transparent;\n    }\n    .outer .nested .grid-stack-item-content {\n      background-color: #18bc9c;\n    }\n  </style>\n</head>\n<body>\n  <h3>show dragging into sub grid</h3>\n  <div class=\"row\">\n    <div class=\"col-md-2 d-none d-md-block\">\n      <div class=\"newWidget grid-stack-item\">\n        <div class=\"card-body grid-stack-item-content\">\n          <span>Drag me in into the dashboard!</span>\n        </div>\n      </div>\n    </div>\n    <div class=\"col-sm-12 col-md-10\">\n      <div class=\"grid-stack outer\" gs-animate=\"yes\">\n        <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"0\" gs-w=\"12\" gs-h=\"3\">\n          <div class=\"grid-stack-item-content\">\n            This nested grid accepts new widget with class \"newWidget\"<br/>\n            The parent grid also accepts new widget but with a different class 'otherWidgetType'<br/>&nbsp;\n            <div class=\"grid-stack nested\"></div>\n          </div>\n        </div>\n      </div>\n    </div>\n  </div>\n\n  <script type=\"text/javascript\">\n    let grid = GridStack.init({ acceptWidgets: '.otherWidgetType' }, '.grid-stack.outer');\n    let gridNest = GridStack.init({\n      acceptWidgets: '.newWidget',\n      itemClass: 'sub',\n    }, '.grid-stack.nested');\n    gridNest.load([\n      {x:0, y:0, w:3, content:'1'},\n      {x:3, y:0, w:3, content:'2'},\n      {x:6, y:0, w:3, content:'2'},\n      {x:9, y:0, w:3, content:'3'},\n      {x:0, y:1, w:3, content:'4'},\n      {x:3, y:1, w:3, content:'5'},\n    ]);\n\n    GridStack.setupDragIn('.newWidget', { appendTo: 'body', helper: 'clone' });\n    \n    grid.on('added removed change', function(e, items) {\n      let str = '';\n      items.forEach(function(item) { str += ' (x,y)=' + item.x + ',' + item.y; });\n      console.log(e.type + ' ' + items.length + ' items:' + str );\n    });\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1155-max-row.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>maxRow Test</title>\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>maxRow Test</h1>\n    <br/>\n    <div class=\"grid-stack\"></div>\n  </div>\n\n  <script type=\"text/javascript\">\n    let grid = GridStack.init({float: true, maxRow: 3});\n    let items = [\n      {x: 0, y: 1, h: 2, content: '0'},\n      {x: 1, y: 3, w: 2,  content: 'Y=3 out of bound should align'}\n    ];\n    grid.load(items);\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1286-load.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>load() Test</title>\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../demo/events.js\"></script>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>load() Test</h1>\n    <br/>\n    <div class=\"grid-stack\">\n      <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"0\" gs-w=\"4\" gs-h=\"2\" gs-id=\"item1\" id=\"item1\">\n        <div class=\"grid-stack-item-content\">item 1</div>\n      </div>\n      <div class=\"grid-stack-item\" gs-x=\"4\" gs-y=\"0\" gs-w=\"4\" gs-h=\"4\" gs-id=\"item2\" id=\"item2\">\n        <div class=\"grid-stack-item-content\">item 2</div>\n      </div>\n    </div>\n  </div>\n  <script type=\"text/javascript\">\n    var grid = GridStack.init();\n    addEvents(grid);\n\n    grid.load([{width:2, height:1, id:'item3'}], true);\n    var layout = grid.save();\n    console.log('layout should be {x:0, y:0, width:2, height:1, id:item3}');\n    console.log(layout);\n    // expect(layout).toEqual([{x:0, y:0, width:2, height:1, id:'item3'}]);\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1330-1559-left-resize-maxW-and-others.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <title>resize maxW</title>\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <p>resize to left with maxW set</p>\n    <div class=\"grid-stack\"></div>\n  </div>\n  <script src=\"../../../demo/events.js\"></script>\n  <script type=\"text/javascript\">\n    let grid = GridStack.init({resizable: { handles: 'sw, se, w, e, s' }});\n    addEvents(grid);\n    grid.load([\n      {x: 2, y: 0, maxW: 1, content: 'max 1'},\n      {x: 5, y: 0, maxW: 2, content: 'max 2'},\n      {x: 7, y: 0, content: 'normal'},\n    ]);\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1419-maxrow1-cant-insert.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>1 row max</title>\n\n  <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css\">\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n  <style type=\"text/css\">\n    .sidebar {\n      background: rgba(0, 255, 0, 0.1);\n      height: 150px;\n      padding: 25px 0;\n      text-align: center;\n    }\n    .sidebar .grid-stack-item {\n      width: 120px;\n      height: 50px;\n      border: 2px dashed green;\n      text-align: center;\n      line-height: 35px;\n      z-index: 10;\n      background: rgba(0, 255, 0, 0.1);\n      cursor: default;\n      display: inline-block;\n    }\n    .sidebar .grid-stack-item .grid-stack-item-content {\n      background: none;\n    }\n  </style>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <p>1 Row max should prevent dragging from outside to push down, only go to empty slot (until we have push right)</p>\n\n    <div class=\"row\">\n      <div class=\"col-md-3\">\n        <div class=\"sidebar\">\n          \n          <div class=\"grid-stack-item\" gs-w=\"2\" gs-h=\"1\">\n            <div class=\"grid-stack-item-content\">Drag me 2x1</div>\n          </div>\n          <div class=\"grid-stack-item\" gs-w=\"1\" gs-h=\"1\">\n            <div class=\"grid-stack-item-content\">Drag me</div>\n          </div>\n\n        </div>\n      </div>\n      <div class=\"col-md-9\">\n        <div class=\"grid-stack\"></div>\n      </div>\n    </div>\n  </div>\n  <script src=\"../../../demo/events.js\"></script>\n  <script type=\"text/javascript\">\n    let options = {\n      row: 1,\n      cellHeight: 120,\n      acceptWidgets: true\n    };\n    let grid = GridStack.init(options);\n    GridStack.setupDragIn('.sidebar .grid-stack-item', { appendTo: 'body', helper: 'clone' });\n    addEvents(grid);\n    grid.addWidget({x: 0});\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/141_1534_swap.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>swap demo</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Swap collision demo</h1>\n    <p>for bugs 141 <b>1094</b> 1534 1605</p>\n    <div>\n      <a class=\"btn btn-primary\" onClick=\"addNewWidget()\" href=\"#\">Add Widget</a>\n      <a class=\"btn btn-primary\" onclick=\"toggleFloat()\" id=\"float\" href=\"#\"></a>\n      <a class=\"btn btn-primary\" onclick=\"toggleMax()\" id=\"max\" href=\"#\"></a>\n      <a class=\"btn btn-primary\" onclick=\"toggleBigger()\" id=\"big\" href=\"#\"></a>\n      with layouts:\n      <a class=\"btn btn-primary\" onclick=\"load(0)\" href=\"#\">load 0</a>\n      <a class=\"btn btn-primary\" onclick=\"load(1)\" href=\"#\">load 1</a>\n      <a class=\"btn btn-primary\" onclick=\"load(2)\" href=\"#\">load 2</a>\n      <a class=\"btn btn-primary\" onclick=\"load(3)\" href=\"#\">load 3</a>\n      <a class=\"btn btn-primary\" onclick=\"load(4)\" href=\"#\">load 4</a>\n      <a class=\"btn btn-primary\" onclick=\"load(5)\" href=\"#\">load web1</a>\n      <a class=\"btn btn-primary\" onclick=\"load(5); loadAdvanced()\" href=\"#\">load web2</a>\n    </div>\n    <br><br>\n    <div class=\"grid-stack\"></div>\n  </div>\n  <script src=\"../../../demo/events.js\"></script>\n  <script type=\"text/javascript\">\n    let floatButton = document.getElementById('float');\n    let maxButton = document.getElementById('max');\n    let bigButton = document.getElementById('big');\n    let size = 1;\n    let layout = 5;\n\n    let opt = {\n      float: false,\n      cellHeight: 70,\n      margin: 5,\n      maxRow: 0,\n      resizable: {handles: 'sw,w,e,se'}\n    };\n    let grid = GridStack.init(opt);\n    addEvents(grid);\n\n    let items = [[ // load 0\n      {x:0, y:0}, {x:0, y:1}, {x:0, y:2},{x:1, y:0}, {x:1, y:1}, {x:1, y:2, /*h:2, w:2*/},\n      {x:5, y:0}, {x:4, y:1, w:3, locked: false, _content: 'locked'}, {x:5, y:2},\n      {x:7, y:0}, {x:8, y:0}, {x:9, y:0}, {x:7, y:1, w:3}, {x:8, y:2},\n      {x:11, y:0}, {x:11, y:1, h:2},\n    ], [ // load 1\n      {x:1, y:0}, {x:1, y:1, w:2}, {x:1, y:2, h:2}, {x:0, y:4, w:3}, \n      {x:3, y:0, w:3, h:3}, {x:6, y:0},\n      {x:7, y:0, w:3}, {x:8, y:1, w:3},\n    ], [ // load 2\n      {x:1, y:0, w:2}, {x:1, y:1, h:2}, {x:2, y:1}, {x:0, y:3, w:3} , {x:0, y:4},\n      // {x:5, y:0, w:2}, {x:6, y:1}, {x:4, y:2, w:3} , {x:5, y:4, h:2}, {x:4, y:4},\n    ], [ // load 3\n      {x:0, y:0, w:6, h:3, content:'drag down past 2, flickers'}, {x:6, y:0, w:6, h:3}, {x:0, y:3, w:8, h:2}, {x:0, y:5, w:4, h:2},\n      // {x:0, y:0, w:1, h:1, content:'drag down past 2'}, {x:1, y:0, w:2, h:1}, {x:0, y:3, w:2, h:1}, {x:0, y:5, w:1, h:1}, // BETTER but quick flicker to end\n    ], [ // load 4\n      {x:0, y:0, w:6, h:2, content:'drag down past 2, re-orders 3'}, {x:6, y:0, w:6, h:2}, {x:0, y:3, w:8, h:1}, {x:0, y:5, w:4, h:1},\n    ],[ // load 5 swap different size\n      {x:0, y:0}, {x:1, y:0, w: 2}, {x:3, y:0, w: 2},\n      {x:0, y:1}, {x:1, y:1}, {x:2, y:1, w: 2}, {x:4, y:1}, \n      {x:1, y:2, h: 2}, {x:1, y:4}\n    ],[ // web1.html demo\n      {x:0, y:0, w:4, h:2},\n      {x:4, y:0, w:4, h:4, id: 'big'},\n      {x:8, y:0, w:2, h:2},\n      {x:10, y:0, w:2, h:2},\n      {x:0, y:2, w:2, h:2},\n      {x:2, y:2, w:2, h:4},\n      {x:8, y:2, w:4, h:2},\n      {x:0, y:4, w:2, h:2},\n      {x:4, y:4, w:4, h:2},\n      {x:8, y:4, w:2, h:2},\n      {x:10, y:4, w:2, h:2}\n    ]];\n    items.forEach(layout => {\n      let count = 0;\n      layout.forEach(n => {n.id = count; n.content = n.content || String(count); count++})\n    });\n    grid.load(items[layout]);\n\n    addNewWidget = function() {\n      let n = {\n        x: Math.round(12 * Math.random()),\n        y: Math.round(5 * Math.random()),\n        w: Math.round(1 + 3 * Math.random()),\n        h: Math.round(1 + 3 * Math.random()),\n        content: String(grid.engine.nodes.length+1)\n      };\n      grid.addWidget(n);\n    };\n\n    load = function(i) {\n      layout = i;\n      grid.removeAll();\n      grid.load(items[i]);\n    }\n    loadAdvanced = function() {\n      grid.update(grid.engine.nodes[1].el, {locked: true, content:'locked'});\n    }\n    toggleFloat = function() {\n      grid.float(! grid.getFloat());\n      floatButton.innerHTML = 'float: ' + grid.getFloat();\n    }\n    floatButton.innerHTML = 'float: ' + grid.getFloat();\n\n    toggleMax = function() {\n      grid.opts.maxRow = grid.engine.maxRow = grid.opts.maxRow ? 0 : 3;\n      maxButton.innerHTML = 'Max: ' + grid.opts.maxRow;\n    }\n    maxButton.innerHTML = 'Max: ' + grid.opts.maxRow;\n\n    toggleBigger = function() {\n      size = size === 1 ? 2 : 1;\n      setSize(size);\n    }\n    setSize = function(size) {\n      items[layout].sort((a,b) => a.id - b.id);\n      items[layout].forEach((n,i) => {\n        if (layout === 0 && i<6) {\n          n.w = n.h = size;\n          n.y = i * size;\n          if (n.x) n.x = size;\n        } else {\n          n.h = size;\n        }\n      });\n      grid.opts.maxRow = grid.engine.maxRow = grid.opts.maxRow ? (size === 1 ? 3 : 6) : 0;\n      grid.load(items[layout]);\n      bigButton.innerHTML = 'Size: ' + size;\n      maxButton.innerHTML = 'Max: ' + grid.opts.maxRow;\n    }\n    bigButton.innerHTML = 'Size: ' + size;\n    if (size !== 1) setSize(size);\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/141_swap_old.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>old swap</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/gridstack@1.0.0/dist/gridstack.min.css\"/>\n  <script src=\"https://cdn.jsdelivr.net/npm/gridstack@1.0.0/dist/gridstack.all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Swap collision demo from older 1.x builds</h1>\n    <div>\n      <a class=\"btn btn-primary\" onClick=\"addNewWidget()\" href=\"#\">Add Widget</a>\n      <a class=\"btn btn-primary\" onclick=\"toggleFloat()\" id=\"float\" href=\"#\"></a>\n      <a class=\"btn btn-primary\" onclick=\"toggleMax()\" id=\"max\" href=\"#\"></a>\n    </div>\n    <br><br>\n    <div class=\"grid-stack\">\n      <div class=\"grid-stack-item\" data-gs-x=\"0\" data-gs-y=\"0\"><div class=\"grid-stack-item-content\">0</div></div>\n      <div class=\"grid-stack-item\" data-gs-x=\"0\" data-gs-y=\"1\"><div class=\"grid-stack-item-content\">1</div></div>\n      <div class=\"grid-stack-item\" data-gs-x=\"0\" data-gs-y=\"2\"><div class=\"grid-stack-item-content\">2</div></div>\n      <div class=\"grid-stack-item\" data-gs-x=\"1\" data-gs-y=\"0\"><div class=\"grid-stack-item-content\">3</div></div>\n      <div class=\"grid-stack-item\" data-gs-x=\"1\" data-gs-y=\"1\"><div class=\"grid-stack-item-content\">4</div></div>\n      <div class=\"grid-stack-item\" data-gs-x=\"1\" data-gs-y=\"2\"><div class=\"grid-stack-item-content\">5</div></div>\n    </div>\n  </div>\n  <script type=\"text/javascript\">\n    let floatButton = document.getElementById('float');\n    let maxButton = document.getElementById('max');\n    let count = 6;\n    let grid = GridStack.init({float: false, cellHeight: 70, maxRow: 3});\n\n    addNewWidget = function() {\n      let n = {\n        x: Math.round(12 * Math.random()),\n        y: Math.round(5 * Math.random()),\n        w: Math.round(1 + 3 * Math.random()),\n        h: Math.round(1 + 3 * Math.random()),\n        content: String(count++)\n      };\n      grid.addWidget(n);\n    };\n\n    toggleFloat = function() {\n      grid.float(! grid.getFloat());\n      floatButton.innerHTML = 'float: ' + grid.float();\n    };\n    floatButton.innerHTML = 'float: ' + grid.float();\n\n    toggleMax = function() {\n      grid.opts.maxRow = grid.engine.maxRow = grid.opts.maxRow ? 0 : 3;\n      maxButton.innerHTML = 'Max: ' + grid.opts.maxRow;\n    };\n    maxButton.innerHTML = 'Max: ' + grid.opts.maxRow;\n\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1471-load-column1.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>load() 1 column</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>load() 1 column</h1>\n    <p>resize to below 768px, reload, then expand up to check 12 column</p>\n    <div>\n      <a class=\"btn btn-primary\" onClick=\"addNewWidget()\" href=\"#\">Add Widget</a>\n      <a class=\"btn btn-primary\" onclick=\"toggleFloat()\" id=\"float\" href=\"#\">float: true</a>\n    </div>\n    <br><br>\n    <div class=\"grid-stack\"></div>\n  </div>\n  <script src=\"../../../demo/events.js\"></script>\n  <script type=\"text/javascript\">\n    let grid = GridStack.init({float: true});\n    addEvents(grid);\n\n    let items = [\n      {x: 1, y: 0, w: 2, content: '0'},\n      {x: 3, y: 1, h: 2, content: '1'},\n      {x: 4, y: 1, content: '2'},\n      {x: 2, y: 3, w: 3,content: '3'},\n      {x: 0, y: 6, w: 2, h: 2, content: '4'}\n    ];\n    grid.load(items);\n\n    addNewWidget = function() {\n      let n = items[count] || {\n        x: Math.round(12 * Math.random()),\n        y: Math.round(5 * Math.random()),\n        w: Math.round(1 + 3 * Math.random()),\n        h: Math.round(1 + 3 * Math.random())\n      };\n      n.content = String(count++);\n      grid.addWidget(n);\n    };\n\n    toggleFloat = function() {\n      grid.float(! grid.getFloat());\n      document.querySelector('#float').innerHTML = 'float: ' + grid.getFloat();\n    };\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1511-drag-any-content.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Float grid demo</title>\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n  <style>\n    .x {\n      width:100%;\n      height:100%;\n    }\n  </style>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Float grid demo</h1>\n    <br><br>\n    <div class=\"grid-stack\"></div>\n  </div>\n  <script src=\"../../../demo/events.js\"></script>\n  <script type=\"text/javascript\">\n    let grid = GridStack.init({float: true, cellHeight: 70});\n    addEvents(grid);\n    var items = [\n      {x: 0, y: 0, w: 2, h: 2, content: '<table class=\"x\"><tr><td><span>table should work</span></td></tr></table>'},\n      {x: 2, y: 0, w: 2, h: 2, content: '<div class=\"x\"><span>using a span</span></div>'},\n      {x: 4, y: 0, w: 2, h: 2, content: '<div class=\"x\">using a div</div>'},\n      {x: 6, y: 0, w: 2, h: 2, content: 'works anywhere'},\n    ];\n\n    grid.load(items);\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1535-out-of-order.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Out of order</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Out of order demo</h1>\n    <div class=\"grid-stack\">\n      <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"2\" gs-w=\"12\" gs-h=\"1\">\n        <div class=\"grid-stack-item-content\">\n          This should be at position <span class=\"order-number\">2</span>\n        </div>\n      </div>\n      <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"1\" gs-w=\"12\" gs-h=\"1\">\n        <div class=\"grid-stack-item-content\">\n          This should be at position <span class=\"order-number\">1</span>\n        </div>\n      </div>\n      <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"0\" gs-w=\"12\" gs-h=\"1\">\n        <div class=\"grid-stack-item-content\">\n          This should be at position <span class=\"order-number\">0</span>\n        </div>\n      </div>\n      <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"4\" gs-w=\"12\" gs-h=\"1\">\n        <div class=\"grid-stack-item-content\">\n          This should be at position <span class=\"order-number\">4</span>\n        </div>\n      </div>\n      <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"5\" gs-w=\"12\" gs-h=\"1\">\n        <div class=\"grid-stack-item-content\">\n          This should be at position <span class=\"order-number\">5</span>\n        </div>\n      </div>\n      <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"6\" gs-w=\"12\" gs-h=\"1\">\n        <div class=\"grid-stack-item-content\">\n          This should be at position <span class=\"order-number\">6</span>\n        </div>\n      </div>\n      <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"7\" gs-w=\"12\" gs-h=\"1\">\n        <div class=\"grid-stack-item-content\">\n          This should be at position <span class=\"order-number\">7</span>\n        </div>\n      </div>\n      <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"11\" gs-w=\"12\" gs-h=\"1\">\n        <div class=\"grid-stack-item-content\">\n          This should be at position <span class=\"order-number\">11</span>\n        </div>\n      </div>\n      <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"8\" gs-w=\"12\" gs-h=\"1\">\n        <div class=\"grid-stack-item-content\">\n          This should be at position <span class=\"order-number\">8</span>\n        </div>\n      </div>\n      <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"9\" gs-w=\"12\" gs-h=\"1\">\n        <div class=\"grid-stack-item-content\">\n          This should be at position <span class=\"order-number\">9</span>\n        </div>\n      </div>\n      <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"12\" gs-w=\"12\" gs-h=\"1\">\n        <div class=\"grid-stack-item-content\">\n          This should be at position <span class=\"order-number\">12</span>\n        </div>\n      </div>\n      <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"10\" gs-w=\"12\" gs-h=\"1\">\n        <div class=\"grid-stack-item-content\">\n          This should be at position <span class=\"order-number\">10</span>\n        </div>\n      </div>\n      <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"3\" gs-w=\"12\" gs-h=\"1\">\n        <div class=\"grid-stack-item-content\">\n          This should be at position <span class=\"order-number\">3</span>\n        </div>\n      </div>\n    </div>\n  </div>\n  <script src=\"events.js\"></script>\n  <script type=\"text/javascript\">\n  GridStack.init({cellHeight: 70});\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1545_disable_move_after.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>disable move after</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>disable move/resize after #1545</h1>\n    <div>\n      <a class=\"btn btn-primary\" onClick=\"addNewWidget()\" href=\"#\">Add Widget</a>\n      <a class=\"btn btn-primary\" onclick=\"toggleFloat()\" id=\"float\" href=\"#\">float: true</a>\n    </div>\n    <br><br>\n    <div class=\"grid-stack\"></div>\n  </div>\n  <script src=\"../../../demo/events.js\"></script>\n  <script type=\"text/javascript\">\n    let grid = GridStack.init({float: true});\n    addEvents(grid);\n\n    let items = [\n      {x: 1, y: 1},\n      {x: 3, y: 0, w: 3},\n      {x: 4, y: 2},\n      {x: 3, y: 1, h: 2},\n      {x: 0, y: 6, w: 2, h: 2}\n    ];\n    let count = 0;\n\n    addNewWidget = function() {\n      let n = items[count] || {\n        x: Math.round(12 * Math.random()),\n        y: Math.round(5 * Math.random()),\n        w: Math.round(1 + 3 * Math.random()),\n        h: Math.round(1 + 3 * Math.random())\n      };\n      n.content = String(count++);\n      grid.addWidget(n);\n    };\n\n    toggleFloat = function() {\n      grid.float(! grid.getFloat());\n      document.querySelector('#float').innerHTML = 'float: ' + grid.getFloat();\n    };\n    addNewWidget();\n    grid.enableMove(false);\n    grid.enableResize(false);\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1558-vertical-grids-scroll-too-much.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>disable move after</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>#1558 items moves too much</h1>\n    <div class=\"grid-stack\">\n      <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"0\" gs-w=\"2\" gs-h=\"1\">\n        <div class=\"grid-stack-item-content\">item1 </div>\n      </div>\n      <div class=\"grid-stack-item\" gs-x=\"3\" gs-y=\"1\" gs-w=\"2\" gs-h=\"1\">\n        <div class=\"grid-stack-item-content\">item2</div>\n      </div>\n    </div>\n    <br>\n    <div class=\"grid-stack\">\n      <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"0\" gs-w=\"2\" gs-h=\"1\">\n        <div class=\"grid-stack-item-content\">item1 </div>\n      </div>\n      <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"1\" gs-w=\"2\" gs-h=\"1\">\n        <div class=\"grid-stack-item-content\">item2</div>\n      </div>\n    </div>\n      </div>\n  <script src=\"../../../demo/events.js\"></script>\n  <script type=\"text/javascript\">\n    var options = {\n      float: true,\n      acceptWidgets: true,\n      cellHeight: 80\n    };\n    GridStack.initAll(options);\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1570_drag_bottom_max_row.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>drop onto full</title>\n\n  <link rel=\"stylesheet\" href=\"../../../dist/gridstack.min.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n  <style type=\"text/css\">\n    *,\n    *::before,\n    *::after {\n        margin: 0;\n        padding: 0;\n        box-sizing: inherit;\n    }\n    html {\n        height: 100vh;\n        width: 100vw;\n        margin: 0;\n        box-sizing: border-box;\n        font-size: 62.5%;\n        background-color: white;\n        display: flex;\n        align-items: center;\n        justify-content: center;\n        overflow: hidden;\n        background-color: rgb(216, 216, 216);\n    }\n    .container {\n        width: 70vw;\n        background-color: rgb(252, 252, 252);\n\n        display: grid;\n        grid-template-rows: 100%;\n        grid-template-columns: 5% 95%;\n        grid-row-gap: 0px;\n        grid-column-gap: 0px;\n    }\n    .side-grid-container {\n        grid-column: 1;\n        height: 100%;\n        width: 100%;\n        background-color: rgb(88, 90, 90);\n    }\n    .main-grid-container {\n        grid-column: 2;\n        height: 100%;\n        width: 100%;\n        background-color: rgb(92, 92, 92);\n    }\n    .grid-stack-item-content{\n        background-color: rgb(206, 214, 167);\n        font-size: large;\n    }\n    .right-grid{\n        background-color: rgb(168, 193, 218);\n    }\n    .left-grid {\n        background-color: rgb(114, 177, 196);\n    }\n    .drag-border {\n        border: solid 5px cyan;\n    }\n  </style>\n</head>\n<body>\n  <div class=\"container\">\n    <div class=\"side-grid-container\">\n      <div id='side-grid' class=\"left-grid grid-stack\">\n      </div>\n    </div>\n    <div class=\"main-grid-container\">\n      <div id=\"main-grid\" class=\"right-grid grid-stack\" >\n      </div>\n    </div>\n </div>\n<script type=\"text/javascript\">\n  let options = {\n    column: 1,\n    margin: 5,\n    disableResize: true\n  }\n\n  let options2 = {\n    minRow: 3,\n    maxRow: 3, // change this to show issue\n    acceptWidgets: true,\n    removable: true,\n    float: true\n  }\n\n  let grid1 = GridStack.init(options, '#side-grid');\n  let grid2 = GridStack.init(options2, '#main-grid');\n\n  let items1 = [\n    {x: 0, y: 0, content: \"1\", id: 1},\n    {x: 0, y: 1, content: \"2\", id: 2},\n    {x: 0, y: 2, content: \"3\", id: 3}\n  ]\n  grid1.load(items1);\n  \n  grid2.load([{x: 1, y: 2, content: \"4\", id: 4}])\n\n  grid2.on('removed', function(e, items) {\n    item = items[0];\n    item.h = item.w = 1;\n    grid1.addWidget(item);\n  })\n\n</script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1571_drop_onto_full.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>drop onto full</title>\n\n  <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css\">\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n  <style type=\"text/css\">\n    .grid-stack-item-removing {\n      opacity: 0.5;\n    }\n    .trash {\n      height: 150px;\n      margin-bottom: 20px;\n      background: rgba(255, 0, 0, 0.1) center center url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjY0cHgiIGhlaWdodD0iNjRweCIgdmlld0JveD0iMCAwIDQzOC41MjkgNDM4LjUyOSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNDM4LjUyOSA0MzguNTI5OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPGc+CgkJPHBhdGggZD0iTTQxNy42ODksNzUuNjU0Yy0xLjcxMS0xLjcwOS0zLjkwMS0yLjU2OC02LjU2My0yLjU2OGgtODguMjI0TDMwMi45MTcsMjUuNDFjLTIuODU0LTcuMDQ0LTcuOTk0LTEzLjA0LTE1LjQxMy0xNy45ODkgICAgQzI4MC4wNzgsMi40NzMsMjcyLjU1NiwwLDI2NC45NDUsMGgtOTEuMzYzYy03LjYxMSwwLTE1LjEzMSwyLjQ3My0yMi41NTQsNy40MjFjLTcuNDI0LDQuOTQ5LTEyLjU2MywxMC45NDQtMTUuNDE5LDE3Ljk4OSAgICBsLTE5Ljk4NSw0Ny42NzZoLTg4LjIyYy0yLjY2NywwLTQuODUzLDAuODU5LTYuNTY3LDIuNTY4Yy0xLjcwOSwxLjcxMy0yLjU2OCwzLjkwMy0yLjU2OCw2LjU2N3YxOC4yNzQgICAgYzAsMi42NjQsMC44NTUsNC44NTQsMi41NjgsNi41NjRjMS43MTQsMS43MTIsMy45MDQsMi41NjgsNi41NjcsMi41NjhoMjcuNDA2djI3MS44YzAsMTUuODAzLDQuNDczLDI5LjI2NiwxMy40MTgsNDAuMzk4ICAgIGM4Ljk0NywxMS4xMzksMTkuNzAxLDE2LjcwMywzMi4yNjQsMTYuNzAzaDIzNy41NDJjMTIuNTY2LDAsMjMuMzE5LTUuNzU2LDMyLjI2NS0xNy4yNjhjOC45NDUtMTEuNTIsMTMuNDE1LTI1LjE3NCwxMy40MTUtNDAuOTcxICAgIFYxMDkuNjI3aDI3LjQxMWMyLjY2MiwwLDQuODUzLTAuODU2LDYuNTYzLTIuNTY4YzEuNzA4LTEuNzA5LDIuNTctMy45LDIuNTctNi41NjRWODIuMjIxICAgIEM0MjAuMjYsNzkuNTU3LDQxOS4zOTcsNzcuMzY3LDQxNy42ODksNzUuNjU0eiBNMTY5LjMwMSwzOS42NzhjMS4zMzEtMS43MTIsMi45NS0yLjc2Miw0Ljg1My0zLjE0aDkwLjUwNCAgICBjMS45MDMsMC4zODEsMy41MjUsMS40Myw0Ljg1NCwzLjE0bDEzLjcwOSwzMy40MDRIMTU1LjMxMUwxNjkuMzAxLDM5LjY3OHogTTM0Ny4xNzMsMzgwLjI5MWMwLDQuMTg2LTAuNjY0LDguMDQyLTEuOTk5LDExLjU2MSAgICBjLTEuMzM0LDMuNTE4LTIuNzE3LDYuMDg4LTQuMTQxLDcuNzA2Yy0xLjQzMSwxLjYyMi0yLjQyMywyLjQyNy0yLjk5OCwyLjQyN0gxMDAuNDkzYy0wLjU3MSwwLTEuNTY1LTAuODA1LTIuOTk2LTIuNDI3ICAgIGMtMS40MjktMS42MTgtMi44MS00LjE4OC00LjE0My03LjcwNmMtMS4zMzEtMy41MTktMS45OTctNy4zNzktMS45OTctMTEuNTYxVjEwOS42MjdoMjU1LjgxNVYzODAuMjkxeiIgZmlsbD0iI2ZmOWNhZSIvPgoJCTxwYXRoIGQ9Ik0xMzcuMDQsMzQ3LjE3MmgxOC4yNzFjMi42NjcsMCw0Ljg1OC0wLjg1NSw2LjU2Ny0yLjU2N2MxLjcwOS0xLjcxOCwyLjU2OC0zLjkwMSwyLjU2OC02LjU3VjE3My41ODEgICAgYzAtMi42NjMtMC44NTktNC44NTMtMi41NjgtNi41NjdjLTEuNzE0LTEuNzA5LTMuODk5LTIuNTY1LTYuNTY3LTIuNTY1SDEzNy4wNGMtMi42NjcsMC00Ljg1NCwwLjg1NS02LjU2NywyLjU2NSAgICBjLTEuNzExLDEuNzE0LTIuNTY4LDMuOTA0LTIuNTY4LDYuNTY3djE2NC40NTRjMCwyLjY2OSwwLjg1NCw0Ljg1MywyLjU2OCw2LjU3QzEzMi4xODYsMzQ2LjMxNiwxMzQuMzczLDM0Ny4xNzIsMTM3LjA0LDM0Ny4xNzJ6IiBmaWxsPSIjZmY5Y2FlIi8+CgkJPHBhdGggZD0iTTIxMC4xMjksMzQ3LjE3MmgxOC4yNzFjMi42NjYsMCw0Ljg1Ni0wLjg1NSw2LjU2NC0yLjU2N2MxLjcxOC0xLjcxOCwyLjU2OS0zLjkwMSwyLjU2OS02LjU3VjE3My41ODEgICAgYzAtMi42NjMtMC44NTItNC44NTMtMi41NjktNi41NjdjLTEuNzA4LTEuNzA5LTMuODk4LTIuNTY1LTYuNTY0LTIuNTY1aC0xOC4yNzFjLTIuNjY0LDAtNC44NTQsMC44NTUtNi41NjcsMi41NjUgICAgYy0xLjcxNCwxLjcxNC0yLjU2OCwzLjkwNC0yLjU2OCw2LjU2N3YxNjQuNDU0YzAsMi42NjksMC44NTQsNC44NTMsMi41NjgsNi41N0MyMDUuMjc0LDM0Ni4zMTYsMjA3LjQ2NSwzNDcuMTcyLDIxMC4xMjksMzQ3LjE3MnogICAgIiBmaWxsPSIjZmY5Y2FlIi8+CgkJPHBhdGggZD0iTTI4My4yMiwzNDcuMTcyaDE4LjI2OGMyLjY2OSwwLDQuODU5LTAuODU1LDYuNTctMi41NjdjMS43MTEtMS43MTgsMi41NjItMy45MDEsMi41NjItNi41N1YxNzMuNTgxICAgIGMwLTIuNjYzLTAuODUyLTQuODUzLTIuNTYyLTYuNTY3Yy0xLjcxMS0xLjcwOS0zLjkwMS0yLjU2NS02LjU3LTIuNTY1SDI4My4yMmMtMi42NywwLTQuODUzLDAuODU1LTYuNTcxLDIuNTY1ICAgIGMtMS43MTEsMS43MTQtMi41NjYsMy45MDQtMi41NjYsNi41Njd2MTY0LjQ1NGMwLDIuNjY5LDAuODU1LDQuODUzLDIuNTY2LDYuNTdDMjc4LjM2NywzNDYuMzE2LDI4MC41NSwzNDcuMTcyLDI4My4yMiwzNDcuMTcyeiIgZmlsbD0iI2ZmOWNhZSIvPgoJPC9nPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+Cjwvc3ZnPgo=) no-repeat;\n    }\n    .sidebar {\n      background: rgba(0, 255, 0, 0.1);\n      height: 150px;\n      padding: 25px 0;\n      text-align: center;\n    }\n    .sidebar .grid-stack-item {\n      width: 120px;\n      height: 50px;\n      border: 2px dashed green;\n      text-align: center;\n      line-height: 35px;\n      z-index: 10;\n      background: rgba(0, 255, 0, 0.1);\n      cursor: default;\n      display: inline-block;\n    }\n    .sidebar .grid-stack-item .grid-stack-item-content {\n      background: none;\n    }\n  </style>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>drop onto full</h1>\n\n    <div class=\"row\">\n      <div class=\"col-md-3\">\n        <div class=\"sidebar\">\n          <!-- will size to match content -->\n          <div class=\"grid-stack-item\">\n            <div class=\"grid-stack-item-content\">Drag me</div>\n          </div>\n          <!-- manually force a drop size of 2x1 -->\n          <div class=\"grid-stack-item\" gs-w=\"2\" gs-h=\"1\" gs-max-w=\"3\">\n            <div class=\"grid-stack-item-content\">2x1, max=3</div>\n          </div>\n        </div>\n      </div>\n      <div class=\"col-md-9\">\n        <div class=\"trash\">\n        </div>\n      </div>\n    </div>\n\n    <div class=\"row\">\n      <div class=\"col-md-6\">\n        <a onClick=\"toggleFloat(this, 0)\" class=\"btn btn-primary\" href=\"#\">float: false</a>\n        <a onClick=\"compact(0)\" class=\"btn btn-primary\" href=\"#\">Compact</a>\n        <div class=\"grid-stack\"></div>\n      </div>\n      <div class=\"col-md-6\">\n        <a onClick=\"toggleFloat(this, 1)\" class=\"btn btn-primary\" href=\"#\">float: false</a>\n        <a onClick=\"compact(1)\" class=\"btn btn-primary\" href=\"#\">Compact</a>\n        <div class=\"grid-stack\"></div>\n      </div>\n    </div>\n  </div>\n  <script src=\"../../../demo/events.js\"></script>\n  <script type=\"text/javascript\">\n    let options = {\n      column: 6,\n      row: 1,\n      cellHeight: 70,\n      float: false,\n      removable: '.trash', // drag-out delete class\n      acceptWidgets: function(el) { return true; } // function example, else can be simple: true | false | '.someClass' value\n    };\n    GridStack.setupDragIn('.sidebar .grid-stack-item', { appendTo: 'body', helper: 'clone' });\n\n    let grids = GridStack.initAll(options);\n    grids[0].load([{x: 4, y: 0, w: 1, h: 1}])\n    grids[1].load([{x: 0, y: 0, w: 6, h: 1}])\n\n    grids.forEach(function (grid, i) {\n      addEvents(grid, i);\n    });\n\n    function toggleFloat(button, i) {\n      grids[i].float(! grids[i].getFloat());\n      button.innerHTML = 'float: ' + grids[i].getFloat();\n    }\n\n    function compact(i) {\n      grids[i].compact();\n    }\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1572_one_column.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>1 column demo</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n  <style type=\"text/css\">\n    .grid-stack {\n      width: 200px;\n    }\n  </style>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>1 column demo</h1>\n    <div>\n      <a class=\"btn btn-primary\" onClick=\"addNewWidget()\" href=\"#\">Add Widget</a>\n      <a class=\"btn btn-primary\" onclick=\"toggleFloat()\" id=\"float\" href=\"#\">float: true</a>\n    </div>\n    <br><br>\n    <div class=\"grid-stack\"></div>\n  </div>\n  <script src=\"../../../demo/events.js\"></script>\n  <script type=\"text/javascript\">\n    let count = 0;\n    let items = [{x: 0, y: 0, w: 1, h:1, content: String(count++)}];\n\n    let grid = GridStack.init({column: 1, minRow: 1});\n    grid.load(items);\n    addEvents(grid);\n\n    addNewWidget = function() {\n      let n = items[count] || {\n        x: Math.round(12 * Math.random()),\n        y: Math.round(5 * Math.random()),\n        w: Math.round(1 + 3 * Math.random()),\n        h: Math.round(1 + 3 * Math.random()),\n        content: String(count++)\n      };\n      grid.addWidget(n);\n    };\n\n    toggleFloat = function() {\n      grid.float(! grid.getFloat());\n      document.querySelector('#float').innerHTML = 'float: ' + grid.getFloat();\n    };\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1581_drag_by_header_h5.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <title>drag by header</title>\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n  <script src=\"https://raw.githack.com/SortableJS/Sortable/master/Sortable.js\"></script>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>dragging by header not conflicting with content drag (Sortable.js)</h1>\n    <h3>sortable.js only</h3>\n    <div>\n      <div id=\"widgetcontent2\" class=\"list-group\"> \n        <div class=\"list-group-item\"> MOVE ME !!!! 11111 11111</div> \n        <div class=\"list-group-item\"> MOVE ME !!!! 22222 22222</div> \n        <div class=\"list-group-item\"> MOVE ME !!!! 33333 33333</div> \n      </div>\n    </div>\n  <br>\n  <div class=\"grid-stack\"></div>\n    \n  </div>\n  <script type=\"text/javascript\">\n//Example Widget HTML Data\nvar html = '\\\n  <div class=\"grid-stack-item\"> \\\n    <div class=\"grid-stack-item-content\" > \\\n      <div class=\"widgetheader\">drag me here</div> \\\n      <div id=\"gridstackwidgetcontent\" class=\"list-group\"> \\\n        <div class=\"list-group-item\"> MOVE ME !!!! 11111 11111</div> \\\n        <div class=\"list-group-item\"> MOVE ME !!!! 22222 22222</div> \\\n        <div class=\"list-group-item\"> MOVE ME !!!! 33333 33333</div> \\\n      </div> \\\n    </div> \\\n  </div>';\n    \n  var options = {\n    float: true, \n    draggable: { handle: '.widgetheader' }\n  };\n  let grid = GridStack.init(options);\n  grid.addWidget(html, {w:2, h:1, x:0, y:0});\n  Sortable.create(gridstackwidgetcontent);\n  Sortable.create(widgetcontent2);\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1658_enableMove.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>enableMove demo</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>enableMove() demo</h1>\n    <div>\n      <a class=\"btn btn-primary\" onClick=\"addNewWidget()\" href=\"#\">Add Widget</a>\n      <a class=\"btn btn-primary\" onclick=\"toggleFloat()\" id=\"float\" href=\"#\">float: true</a>\n      <a class=\"btn btn-primary\" onclick=\"grid.enableMove(true)\" href=\"#\">enable</a>\n      <a class=\"btn btn-primary\" onclick=\"grid.disable()\" href=\"#\">disable</a>\n    </div>\n    <br><br>\n    <div class=\"grid-stack\"></div>\n  </div>\n  <script src=\"../../../demo/events.js\"></script>\n  <script type=\"text/javascript\">\n    let grid = GridStack.init({disableResize: true, disableDrag: true});\n    addEvents(grid);\n\n    let items = [\n      {x: 1, y: 1},\n      {x: 2, y: 2, w: 3},\n      {x: 4, y: 2},\n      {x: 3, y: 1, h: 2},\n      {x: 0, y: 6, w: 2, h: 2}\n    ];\n    let count = 0;\n\n    addNewWidget = function() {\n      let n = items[count] || {\n        x: Math.round(12 * Math.random()),\n        y: Math.round(5 * Math.random()),\n        w: Math.round(1 + 3 * Math.random()),\n        h: Math.round(1 + 3 * Math.random())\n      };\n      n.content = String(count++);\n      grid.addWidget(n);\n    };\n\n    toggleFloat = function() {\n      grid.float(! grid.getFloat());\n      document.querySelector('#float').innerHTML = 'float: ' + grid.getFloat();\n    };\n    addNewWidget();\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1693_load_after.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>load after init</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>load after init</h1>\n    <div class=\"grid-stack\">\n      <div class=\"grid-stack-item\" gs-id=\"id1\">\n           <div class=\"grid-stack-item-content\">\n               widget 1 \n            </div>\n      </div>\n       <div class=\"grid-stack-item\" gs-id=\"id2\" >\n          <div class=\"grid-stack-item-content\">\n             widget 2 \n          </div>\n      </div>\n  </div>  </div>\n  <script src=\"../../../demo/events.js\"></script>\n  <script type=\"text/javascript\">\n    var data = [{id: \"id1\",x:0,y:0,w:2,h:1}, {id: \"id2\",x:3,y:0,w:3,h:2} ];\n    var grid = GridStack.init();\n    grid.load(data);\n   </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1704_scroll_bar.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css\"></link>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n  <style>\n    #trash {\n      background: rgba(255, 0, 0, 0.4);\n    }\n    .two {\n      background: lavender;\n    }\n  </style>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <div class=\"row\">\n      <div class=\"col-md-2 d-none d-md-block\" style=\"position: relative;\">\n        <div style=\"position: sticky; top: 0;\">\n          <div id=\"trash\" style=\"padding: 5px; margin-bottom: 15px;\" class=\"text-center\">remove</div>\n          <div class=\"newWidget grid-stack-item\" gs-min-w=\"3\">\n            <div class=\"grid-stack-item-content\" style=\"padding: 5px;\">add</div>\n          </div>\n        </div>\n      </div>\n      <div class=\"col-sm-12 col-md-10\">\n        <div class=\"grid-stack\"></div>\n        <div class=\"grid-stack two\"></div>\n      </div>\n    </div>\n  <script type=\"text/javascript\">\n    let grids = GridStack.initAll({\n      acceptWidgets: true,\n      removable: \"#trash\", // drag-out delete class\n      removeTimeout: 100,\n      float: true,\n      row: 3,\n    });\n    GridStack.setupDragIn('.newWidget', { appendTo: 'body', helper: 'clone' });\n    // let items = [{x: 0, y: 0, content: \"0\"}];\n    // grids.forEach(grid => grid.load(items));\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1727_resize_scroll_top.html",
    "content": "<!DOCTYPE html>\r\n<html lang=\"en\">\r\n<head>\r\n  <meta charset=\"utf-8\">\r\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\r\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\r\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\r\n  <script src=\"../../../dist/gridstack-all.js\"></script>\r\n  <style>\r\n    .topHeader {\r\n      background: rgb(127, 87, 180);\r\n      height: 200px;\r\n    }\r\n    .willScroll {\r\n      height: 600px;\r\n      overflow-y: auto;\r\n      flex-grow: 1;\r\n    }\r\n    .row {\r\n      display:flex;\r\n      width: 100%;\r\n    }\r\n    .showDistance {\r\n      border-top-width: 130px;\r\n      border-bottom-width: 130px;\r\n      border-color: gray;\r\n      border-style: solid;\r\n      height: 600px;\r\n      width: 50px;\r\n      box-sizing: border-box;\r\n    }\r\n    .outer {\r\n      display: flex;\r\n    }\r\n    .main {\r\n      flex-grow: 1;\r\n    }\r\n    .bodyScroll {\r\n      height: 2000px;\r\n      width: 100px;\r\n      flex: 0 0 auto;\r\n      border: 3px solid blue;\r\n    }\r\n  </style>\r\n\r\n</head>\r\n<body>\r\n  <div class=\"outer\">\r\n    <div class=\"main\">\r\n      <div class=\"topHeader\">\r\n        This page allows to test scrolling behavior when scroll element is not whole page (html element),\r\n        and when the scrolling element is not at the top of the page. Also effects of multiple\r\n        scrollbars can be tested, as the html element also can be scrolled.<br>\r\n        This is the header which brings an offset of 200 px</div>\r\n      <div class=\"row\">\r\n        <div class=\"showDistance\"></div>\r\n        <div class=\"willScroll\">\r\n          <div class=\"grid-stack\"></div>\r\n        </div>    \r\n      </div>    \r\n    </div>\r\n    <div class=\"bodyScroll\">This causes the scrollbar on html element</div>\r\n  </div>\r\n\r\n  <script type=\"text/javascript\">\r\n    let grid = GridStack.init({cellHeight: 130});\r\n    let items = [\r\n      {x: 0, y: 0, w: 2, h: 2, content: \"resize-me - check scrolling starts only when in height of gray area, and you can scroll back up as well.\"},\r\n      {x: 3, y: 0, w: 2, h: 2, content: \"this is here to have next item positioned way down\"},\r\n      {x: 3, y: 2, w: 3, h: 2, content: \"resize me - scroll will start immediately, but should not be extremely fast\"},\r\n      {x: 6, y: 0, w: 2, h: 8, content: \"this is here to have a scroll bar on .main div from the beginning\"},\r\n    ];\r\n    grid.load(items);\r\n  </script>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "spec/e2e/html/1785_column_many_switch.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Changing Column a lot</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Changing Column 5 x 12 causing overlap https://github.com/gridstack/gridstack.js/issues/1785</h1>\n    <div>\n      <a class=\"btn btn-primary\" onClick=\"next()\" href=\"#\">Next</a>\n      <a class=\"btn btn-primary\" onclick=\"auto()\" href=\"#\">Auto</a>\n    </div>\n\n    <div class=\"grid-stack\"></div>\n  </div>\n  <script src=\"events.js\"></script>\n  <script type=\"text/javascript\">\n    let count = 0;\n    let grid;\n    let items = [ \n      // simplest case data would show the issue at 7 column (overlapping 0 & 2)\n      // {x: 0, y: 0},\n      // {x: 2, y: 0, w: 3},\n      // {x: 0, y: 1, w: 2},\n      // {x: 3, y: 1, h: 2},\n      // {x: 6, y: 6, w: 3, h: 2}\n    ];\n    items.forEach(item => item.content = String(count++));\n\n    function addNewWidget() {\n      var node = items[count] || {\n        x: Math.round(12 * Math.random()),\n        y: Math.round(5 * Math.random()),\n        w: Math.round(1 + 3 * Math.random()),\n        h: Math.round(1 + 3 * Math.random())\n      };\n      node.content = String(count++);\n      if (grid) {\n        grid.addWidget(node);\n      } else {\n        items.push(node);\n      }\n    };\n\n    grid = GridStack.init({cellHeight: 50, margin: 5}).load(items);\n    let column = 1;\n    for (i=0; i<7; i++) addNewWidget(); // load 7 random items\n\n    function next() {\n      setColumn(column++);\n      if (column > 12) { column = 1; }\n    }\n    function auto() {\n      for (let i = 1; i <= 12; i++) {\n        setColumn(i);\n      }\n    }\n    function setColumn(n) {\n      console.log(\"gridding at\", n);\n      grid.column(n);\n      grid.compact();\n    }\n    for (let i = 1; i <= 5; i++) {\n      auto();\n    }\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1858_full_grid_overlap.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>1858</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Full grid, drag 0 out and back in - see 1858</h1>\n    <div class=\"grid-stack\"></div>\n  </div>\n  <script type=\"text/javascript\">\n    options = {\n      row: 15,\n      margin: 2,\n      cellHeight: 20,\n      acceptWidgets: true,\n      float: false,\n    };\n\n    GridStack.init(options).load([\n      { x: 0, y: 0, w: 4, h: 6, content:'0' },\n      { x: 0, y: 6, w: 4, h: 2, content:'1' },\n      { x: 0, y: 8, w: 4, h: 2, content:'2' },\n      { x: 0, y: 10, w: 4, h: 2, content:'3' },\n      { x: 0, y: 12, w: 12, h: 3, content:'4' },\n      { x: 4, y: 0, w: 8, h: 12, content:'5' },\n    ])\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1924-many.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Many items</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Many items speed test</h1>\n    <div>\n      <a class=\"btn btn-primary\" onClick=\"addNewWidget()\" href=\"#\">Add Widget</a>\n      <a class=\"btn btn-primary\" onclick=\"toggleFloat()\" id=\"float\" href=\"#\">float: true</a>\n    </div>\n    <br><br>\n    <div class=\"grid-stack\"></div>\n  </div>\n  <script src=\"events.js\"></script>\n  <script type=\"text/javascript\">\n    let items = [];\n    for (i=0; i<200; i++) {\n      items[i] = {w: Math.round(1 + 3 * Math.random()), h: Math.round(1 + 3 * Math.random()), content: String(i)};\n      // items[i] = {w:1, h:1, content: String(i)};\n    }\n\n    let grid = GridStack.init({\n      cellHeight: 50,\n      margin: 5,\n      float: true, \n      // animate: false,\n    }).load(items);\n\n    addNewWidget = function() {\n      let n = {\n        x: Math.round(12 * Math.random()),\n        y: Math.round(5 * Math.random()),\n        w: Math.round(1 + 3 * Math.random()),\n        h: Math.round(1 + 3 * Math.random()),\n        content: 'new'\n      };\n      grid.addWidget(n);\n    };\n\n    toggleFloat = function() {\n      grid.float(! grid.getFloat());\n      document.querySelector('#float').innerHTML = 'float: ' + grid.getFloat();\n    };\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/1985_read_1_column_wrong_12.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>read 1 column</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>read from dom into 1 column has wrong order and 12 column layout</h1>\n    <div class=\"grid-stack\">\n      <div class=\"grid-stack-item\" gs-x=\"4\" gs-y=\"0\"><div class=\"grid-stack-item-content\">1</div></div>\n      <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"0\"><div class=\"grid-stack-item-content\">0</div></div>\n      <div class=\"grid-stack-item\" gs-x=\"1\" gs-y=\"1\"><div class=\"grid-stack-item-content\">2</div></div>\n    </div>\n  </div>\n  <script type=\"text/javascript\">\n    let grid = GridStack.init({\n      cellHeight: 70,\n      float: true, \n    });\n\n    var items = [\n      {x: 0, y: 0, content: '0'},\n      {x: 2, y: 0, content: '1'},\n    ];\n    // grid.addWidget(items[1]); // need to be reverse sort-order to be correct (otherwise DOM above is wrong)\n    // grid.addWidget(items[0]);\n    // grid.load(items); // or this work (code reverse sort)\n\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/2206_load_collision.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Float grid demo</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>2208 layout</h1>\n    <div>\n      <a class=\"btn btn-primary\" onClick=\"update()\" href=\"#\">Update 0</a>\n      <a class=\"btn btn-primary\" onClick=\"load()\" href=\"#\">load 0</a>\n      <a class=\"btn btn-primary\" onClick=\"loadFull()\" href=\"#\">load full 0</a>\n    </div>\n    <br><br>\n    <div class=\"grid-stack\"></div>\n  </div>\n  <script src=\"../../../demo/events.js\"></script>\n  <script type=\"text/javascript\">\n    let items = [\n      {id: '0', x: 0, y: 0, w: 12, content: '0'},\n      {id: '1', x: 0, y: 1, w: 12, content: '1'},\n      {id: '2', x: 0, y: 2, w: 12, content: '2'},\n      {id: '3', x: 0, y: 3, w: 12, content: '3'},\n    ];\n\n    let grid = GridStack.init({\n      cellHeight: 70,\n      children: items,\n    });\n    addEvents(grid);\n\n    // this is much better way, but testing original #2206 bug below too\n    update = function() {\n      const n = grid.engine.nodes[0];\n\t    grid.update(n.el, {h: n.h === 5 ? 1 : 5});\n    }\n\n    load = function() {\n      items[0].h = items[0].h === 5 ? 1 : 5\n      grid.load(items);\n    }\n\n    loadFull = function() {\n      grid.load(grid.engine.nodes.map((n, index) => {\n        if (index === 0) return {...n, h: n.h === 5 ? 1 : 5}\n        return n;\n      }));\n    }\n\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/2232_dom_auto_placement_mix.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>DOM reading</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>DOM reading, with auto placement mix (1&2 set, others not)</h1>\n    <div class=\"grid-stack\">\n      <div class=\"grid-stack-item\" gs-w=\"12\" gs-x=\"0\" gs-y=\"0\">\n        <div class=\"grid-stack-item-content\">1</div>\n      </div>\n      <div class=\"grid-stack-item\" gs-w=\"4\" gs-x=\"0\" gs-y=\"1\">\n        <div class=\"grid-stack-item-content\">2</div>\n      </div>\n      <div class=\"grid-stack-item\" gs-w=\"4\">\n        <div class=\"grid-stack-item-content\">3</div>\n      </div>\n      <div class=\"grid-stack-item\">\n        <div class=\"grid-stack-item-content\">4</div>\n      </div>\n    </div>\n      </div>\n  <script type=\"text/javascript\">\n    let grid = GridStack.init({cellHeight: 70});\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/2357_rem.html",
    "content": "<!DOCTYPE html>\n<head>\n  <title>REM demo</title>\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <div class=\"grid-stack\"></div>\n  <script type=\"text/javascript\">\n    let items = [\n      {x: 0, y: 0},\n      {x: 1, y: 0},\n    ];\n    let count = 0;\n    items.forEach(d => d.content = String(count++));\n\n    let grid = GridStack.init({\n      // cellHeight: '90',\n      cellHeight: '8rem',\n    }).load(items);\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/2384_update_content.html",
    "content": "<!DOCTYPE html>\n<head>\n  <title>Nested grid update content</title>\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <style type=\"text/css\">\n    .grid-stack {\n      background: lightgoldenrodyellow;\n    }\n    .grid-stack-item-content {\n      color: #2c3e50;\n      text-align: center;\n      background-color: #18bc9c;\n    }\n    .grid-stack.grid-stack-nested {\n      position: absolute;\n      inset: 20px 0 0 0; \n      border: 1px solid black;\n    }\n  </style>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <h1>Nested grid when updating content</h1>\n  <div>\n    <button onClick=\"updateContent()\">Update Subgrid</button>\n    <button onClick=\"move()\">move Subgrid</button>\n  </div>\n  <br/>\n  <div class=\"grid-stack\"></div>\n  <script type=\"text/javascript\">\n    var options = {\n      cellHeight: 70,\n      acceptWidgets: true,\n      margin: 5,\n      children: [\n        {x:0, y:0, w:2, h:2, content: 'original content', subGridOpts: {\n          children: [{x:0, y:0, content: '1'}, {x:1, y:0, content: '2'}], cellHeight: 50, column: 2, margin: 5, acceptWidgets: true,\n        }},\n      ]\n    };\n\n    var grid = GridStack.init(options);\n\n    updateContent = function() {\n      const n = grid.engine.nodes[0];\n      grid.update(n.el, {content: \"updated content\"});\n    }\n\n    move = function() {\n      const n = grid.engine.nodes[0];;\n      grid.update(n.el, {x: n.x+1});\n    }\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/2394_save_sub_item_moved.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>#2394 Save sub item moved</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\" />\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <h1>#2394 Save sub item moved</h1>\n  <button onClick=\"print()\">Save</button>\n  <!-- <button onClick=\"reset()\">Reset</button> -->\n  <button onClick=\"load()\">Load</button>\n  <br><br>\n  <div class=\"grid-stack\"></div>\n\n  <script type=\"text/javascript\">\n    let subGridOpts = {\n        cellHeight: 50,\n        column: 3,\n        padding: 5,\n        minRow: 2, // don't collapse when empty\n        acceptWidgets: true,\n        children: [ {id:0, x:0, y:0, w:3, content:'move to parent grid col=2'}]\n      };\n\n    var options = { // put in gridstack options here\n      cellHeight: 70,\n      column: 2,\n      minRow: 3,\n      acceptWidgets: true,\n      children: [\n        {id:1, x:0, y:0, w:2, h:2, content:'3 columns', subGridOpts: subGridOpts },\n        {id:2, x:0, y:2, w:1, y:1, content:'widget' }\n      ]\n    };\n    var grid = GridStack.init(options);\n    var layout;\n\n    print = function() {\n      layout = grid.save(false, false);\n      console.log(layout);\n    }\n    load = function() {\n      grid.load(layout);\n    }\n    // reset = function() {\n    //   grid.removeAll();\n    // }\n    print()\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/2406_inf_loop_autoPosition_column1.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Float grid demo</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\" />\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n</head>\n\n<body>\n  <h1>1 column, autoPosition bug</h1>\n  <p>add a widget, switch to 2 column, add another widget</p>\n  <div><a class=\"btn btn-default\" onClick=\"addNewWidget()\" href=\"#\">Add Widget</a></div>\n  <div><a class=\"btn btn-default\" onClick=\"resizeColumns()\" href=\"#\">Resize Columns</a></div>\n  <br />\n  <div class=\"grid-stack\"></div>\n  <script src=\"events.js\"></script>\n  <script type=\"text/javascript\">\n    var options = {\n      float: false,\n      column: 1,\n      cellHeight: 100\n    };\n    var grid = GridStack.init(options);\n    var count = 0;\n\n    addNewWidget = function () {\n      var node = {\n        autoPosition: true,\n        x: Math.round(12 * Math.random()),\n        y: Math.round(5 * Math.random()),\n        w: Math.round(1 + 3 * Math.random()),\n        h: Math.round(1 + 3 * Math.random()),\n        content: String(count++),\n      };\n      grid.addWidget(node);\n    };\n\n    resizeColumns = function () {\n      grid.column(2);\n    }\n  </script>\n</body>\n\n</html>"
  },
  {
    "path": "spec/e2e/html/2453 _recreated_trash.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>#2453 Recreated trash</title>\n\n  <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css\">\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\" />\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n  <style type=\"text/css\">\n    .with-lines { border: 1px dotted #777}\n  </style>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>#2453 Recreated grid trash bug</h1>\n\n    <div class=\"row\">\n      <div class=\"col-md-3\">\n        <div class=\"sidebar\">\n          <!-- will size to match content -->\n          <div class=\"grid-stack-item\">\n            <div class=\"grid-stack-item-content\">Drag me</div>\n          </div>\n          <!-- manually force a drop size of 2x1 -->\n          <div class=\"grid-stack-item\" gs-w=\"2\" gs-h=\"1\" gs-max-w=\"3\">\n            <div class=\"grid-stack-item-content\">2x1, max=3</div>\n          </div>\n        </div>\n      </div>\n      <div class=\"col-md-9\">\n        <div class=\"trash\" id=\"trash\">\n        </div>\n      </div>\n    </div>\n\n    <div class=\"row\" style=\"margin-top: 20px\">\n      <div class=\"col-md-12\">\n        <a onClick=\"recreate()\" class=\"btn btn-primary\" href=\"#\">Destroy(false)+init()</a>\n        <div class=\"grid-stack\" id=\"left_grid\"></div>\n      </div>\n    </div>\n  </div>\n  <script src=\"events.js\"></script>\n  <script type=\"text/javascript\">\n    let items = [\n      {x: 0, y: 0, w: 2, h: 2},\n      {x: 3, y: 1, h: 2},\n      {x: 4, y: 1},\n      {x: 2, y: 3, w: 3, maxW: 3, id: 'special', content: 'has maxW=3'},\n      {x: 2, y: 5}\n    ];\n\n    let options = {\n      column: 6,\n      minRow: 1, // don't collapse when empty\n      cellHeight: 70,\n      float: true,\n      removable: '.trash', // true or drag-out delete class\n      acceptWidgets: true\n    };\n    let grid = GridStack.init(options).load(items);\n\n    GridStack.setupDragIn('.sidebar .grid-stack-item', { appendTo: 'body', helper: 'clone' });\n\n    function recreate() {\n      grid.destroy(false);\n      grid = GridStack.init(options);\n    }\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/2469_min-height.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Flex display test #2469</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\" />\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n  <style type=\"text/css\">\n    .some-flex-wrapper {\n      display: flex;\n      flex-direction: column;\n    }\n  </style>\n\n</head>\n<body>\n  <h1>Flex display test #2469</h1>\n  <div class=\"some-flex-wrapper\">\n    <div class=\"grid-stack\"></div>\n  </div>\n  <script src=\"events.js\"></script>\n  <script type=\"text/javascript\">\n    let grid = GridStack.init({\n      float: false,\n      cellHeight: '120px',\n      minRow: 1,\n      margin: 10,\n    });\n\n    let items = [\n      {x: 1, y: 1, content:'0'},\n      {x: 2, y: 2, w: 3, content:'1'},\n    ];\n    grid.load(items);\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/2492_load_twice.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>load() twice bug</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\" />\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>load twice bug</h1>\n    <p>this load() twice in a row with overlapping content and floating item</p>\n    <div class=\"grid-stack\"></div>\n  </div>\n  <script type=\"text/javascript\">\n    let items = [\n      {x: 0, y: 0, w:2, content: '0 wide'},\n      {x: 1, y: 0, content: '1 over'},\n      {x: 2, y: 1, content: '2 float'},\n    ];\n    let count = 0;\n    items.forEach(n => n.id = String(count++)); // TEST loading with ids\n    let grid = GridStack.init({cellHeight: 70, margin: 5, children: items})\n    items.forEach(n => n.content += '*')\n    grid.load(items);\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/2576_insert_column_shift_content.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Column insert bug #2576</title>\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\" />\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n</head>\n\n<body>\n  <button onClick=\"addColAtIndex(0)\">Add column 0</button>\n  <button onClick=\"removeColAtIndex(0)\">Remove column 0</button>\n  <div class=\"grid-stack\"></div>\n  </div>\n  <script type=\"text/javascript\">\n    var items = [\n      { content: 'Item 1', x: 0, y: 0 },\n      { content: 'Item 2', x: 1, y: 0 },\n      { content: 'Item 3', x: 2, y: 2 },\n    ];\n    var options = { float: true, column: 3, row: 3, cellHeight: 50, children: items};\n\n    var grid = GridStack.init(options);\n\n    const addColAtIndex = (colIndex) => {\n      grid.column(grid.getColumn() + 1, 'none');\n      grid.engine.nodes.filter(n => n.x >= colIndex).sort((a, b) => b.x - a.x).forEach(n =>\n        grid.update(n.el, {x: n.x+1})\n      )\n    };\n\n    const removeColAtIndex = (colIndex) => {\n      grid.engine.nodes.filter(n => n.x >= colIndex).sort((a, b) => a.x - b.x).forEach(n => {\n        if (n.x) grid.update(n.el, {x: n.x-1})\n      })\n      grid.column(grid.getColumn() - 1, 'none')\n    };\n\n    addColAtIndex(0)\n    addColAtIndex(0)\n    removeColAtIndex(0)\n    removeColAtIndex(0)\n    addColAtIndex(0)\n    addColAtIndex(0)\n  </script>\n</body>\n\n</html>"
  },
  {
    "path": "spec/e2e/html/2633_drop_full_crash.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>#2633 Drop into full crash</title>\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\" />\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>#2633 Drop into full crash</h1>\n    <div class=\"grid-stack-item\" gs-w=\"2\" gs-h=\"2\">\n      <div class=\"grid-stack-item-content\">2x2</div>\n    </div>\n    <br><br>\n    <div class=\"grid-stack\"></div>\n  </div>\n  <script src=\"events.js\"></script>\n  <script type=\"text/javascript\">\n    var count = 0;\n    var items = [\n      {x: 0, y: 0, w: 2, h: 2},\n      {x: 2, y: 0, w: 2, h: 2},\n      {x: 4, y: 0, w: 2, h: 2},\n      {x: 6, y: 0, w: 2, h: 2},\n      {x: 8, y: 0, w: 2, h: 2},\n      {x: 10, y: 0, w: 2, h: 2},\n    ];\n    items.forEach(w => w.content = String(count++));\n\n    var options = { // put in gridstack options here\n      float: false,\n      acceptWidgets: true,\n      maxRow: 2\n    };\n    var grid = GridStack.init(options).load(items);\n\n    GridStack.setupDragIn('.grid-stack-item', { appendTo: 'body', helper: 'clone' });\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/2639_load_missing_coord.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>#2639 load() fix</title>\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\" />\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>#2639 load() fix with mix of missing coordinates.</h1>\n    <div>\n      <button onClick=\"addNewWidget()\">Add widget using .addWidget()</button>\n      <button onClick=\"loadNewWidget()\">Add widget using .load()</button>\n    </div>\n    <br><br>\n    <div class=\"grid-stack\"></div>\n    <textarea readonly rows=\"20\" id=\"text\" style=\"width: 100%;\"></textarea>\n  </div>\n  <script src=\"events.js\"></script>\n  <script type=\"text/javascript\">\n    saveGrid = function() {\n      items = grid.save();\n      document.querySelector('#text').innerHTML = JSON.stringify(items, ' ', 2)\n    }\n\n    var count = 0;\n    var items = [\n      {x: 0, y: 0, w: 2, h: 2},\n      {x: 2, y: 0, w: 8, h: 2},\n      {x: 0, y: 2, w: 6, h: 2},\n      {x: 6, y: 2, w: 3, h: 2},\n      {x: 9, y: 2, w: 3, h: 2},\n      {x: 0, y: 4, w: 5, h: 3},\n    ].map(w => ({\n      ...w,\n      id: String(count),\n      content: String(count++)\n    }));\n\n    var options = { // put in gridstack options here\n      float: false,\n      cellHeight: 70,\n    };\n    var grid = GridStack.init(options).load(items);\n    grid.on('change added', saveGrid);\n    saveGrid();\n\n    createNode = function (str) {\n      return {\n        id: String(count),\n        w: 3,\n        h: 3,\n        content: `${count++} ${str}`,\n      };\n    }\n\n    // Gets placed in the next hortizontal open slot\n    addNewWidget = function () {\n      grid.addWidget(createNode('added'));\n      return false;\n    };\n\n    // Gets placed at the bottom of a grid\n    loadNewWidget = function () {\n      items.push(createNode('loaded'));\n      grid.load(items);\n      return false;\n    }\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/2677_drag_button.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>drag button demo</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\" />\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n  <style>\n    .handle { cursor: move }\n  </style>\n</head>\n<body>\n  <div class=\"grid-stack\"></div>\n  <script type=\"text/javascript\">\n    let items = [\n      {x: 0, y: 0, content: '<button class=\"handle\">Handle</button>'},\n      {x: 1, y: 0, w: 3, content: '<span class=\"handle\">Handle</span>'},\n    ];\n    let grid = GridStack.init({handle: '.handle', cellHeight: 70}).load(items);\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/2729_web_component_drag_esc.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n    <title>Custom element test</title>\n    <link rel=\"stylesheet\" href=\"../../../demo/demo.css\" />\n    <script src=\"../../../dist/gridstack-all.js\"></script>\n  </head>\n  <body>\n    <p> cancel:\".no-drag\" does not work when placed within a web component (case 2)</p>\n    <div class=\"grid-stack\"></div>\n    <script type=\"text/javascript\">\n      // NOTE: REAL apps would sanitize-html or DOMPurify before blinding setting innerHTML. see #2736\n      GridStack.renderCB = function (el, w) {\n        el.innerHTML = w.content;\n      };\n\n      class CustomElement extends HTMLElement {\n        constructor(name) {\n          super();\n          this.subject = name || \"World\";\n          // create a Shadow DOM\n          this.root = this.attachShadow({ mode: \"open\" });\n        }\n        // run some code when the component is ready\n        connectedCallback() {\n          this.root.innerHTML = this.getTemplate();\n        }\n        // create templates that interpolate variables and HTML!\n        getTemplate() {\n          return `<div>web component case:</div><button onclick=\\\"alert('clicked!')\\\">Press me</button><div>text area</div><div><textarea></textarea></div><div>Input Field</div><input type=\"text\"><div contenteditable=\\\"true\\\">Editable Div</div><div class=\\\"no-drag\\\">SHOULD be no drag</div>`;\n        }\n      }\n      customElements.define(\"custom-element\", CustomElement);\n\n      var children = [\n        { content: \"0\" },\n        { w: 2, h: 3, content: `<button onclick=\\\"alert('clicked!')\\\">Press me</button><div>text area</div><div><textarea></textarea></div><div>Input Field</div><input type=\"text\"><div contenteditable=\\\"true\\\">Editable Div</div><div class=\\\"no-drag\\\">no drag</div>` },\n        { w: 2, h: 3, content: `<custom-element></custom-element>` },\n      ];\n\n      var options = {\n        // put in gridstack options here\n        cellHeight: 80,\n        children,\n        draggable: {\n          cancel: \".no-drag\",\n        }, // example of additional custom elements to skip drag on\n      };\n      var grid = GridStack.init(options);\n    </script>\n  </body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/2864_nested_resize_reflow.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>2864 nest grid resize</title>\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <h1>2864 nest grid resize</h1>\n  <p>Test for nested grid resize reflowing content (manually and API)</p>\n  <a class=\"btn btn-primary\" onClick=\"step1()\" href=\"#\">resize</a>\n  <div class=\"grid-stack\">\n    <!-- <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"0\" gs-w=\"4\" gs-h=\"2\" gs-id=\"gsItem1\" id=\"item1\">\n      <div class=\"grid-stack-item-content\">item 1 text</div>\n    </div>\n    <div class=\"grid-stack-item\" gs-x=\"4\" gs-y=\"0\" gs-w=\"4\" gs-h=\"4\" gs-id=\"gsItem2\" id=\"item2\">\n      <div class=\"grid-stack-item-content\">item 2 text</div>\n    </div> -->\n  </div>\n  <script type=\"text/javascript\">\n    // test for spec file debugging\n    let margin = 5;\n    let cellHeight = 70;\n    let children = [{},{},{}];\n      let items = [\n        {x: 0, y: 0, w:3, h:3, sizeToContent: true, \n          subGridOpts: {children, column: 'auto', margin, cellHeight}}\n      ];\n      let count = 0;\n      [...items, ...children].forEach(n => { n.id = String(count++); if (count>1) n.content=n.id});\n      grid = GridStack.init({cellHeight: cellHeight+20, margin, children: items});\n\n    step1 = function() {\n      grid.update(grid.engine.nodes[0].el, {w:2});\n    }\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/2947_load_responsive_list_smaller.html",
    "content": "<!DOCTYPE html>\n<head>\n  <title>Responsive column</title>\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <h1>Responsive: load into smaller size</h1>\n  <span>Number of Columns:</span> <span id=\"column-text\"></span>\n  <div class=\"grid-stack\">\n  \n  <script type=\"text/javascript\">\n    let children = [ // our initial 12 column layout\n      {x: 0, y: 0, w: 12},\n      {x: 0, y: 1, w: 3},\n      {x: 3, y: 1, w: 3},\n      {x: 6, y: 1, w: 3},\n      {x: 9, y: 1, w: 3},\n    ];\n    children.forEach((n, i) => {n.id = i; n.content = String(i)});\n\n    let grid = GridStack.init({\n      cellHeight: 80,\n      columnOpts: {\n        breakpoints: [\n          { c: 8, w: 1200 },\n          { c: 6, w: 996 },\n          { c: 3, w: 768 },\n          { c: 1, w: 480 },\n        ],\n        layout: \"list\",\n      },\n      children})\n    .on('change', (ev, gsItems) => text.innerHTML = grid.getColumn());\n\n    let text = document.querySelector('#column-text');\n    text.innerHTML = grid.getColumn();\n  </script>\n</body>\n</html>"
  },
  {
    "path": "spec/e2e/html/2951_shadow_dom.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n    <title>Shadow DOM dragging</title>\n    <script src=\"../../../dist/gridstack-all.js\"></script>\n  </head>\n  <body>\n    <h2>Inside Custom Element with Shadow DOM</h2>\n    <demo-gridstack></demo-gridstack>\n    <script type=\"text/javascript\">\n      class HTMLDemoGridStack extends HTMLElement {\n        constructor() {\n          super();\n          this.attachShadow({\n            mode: \"open\",\n          });\n        }\n\n        connectedCallback() {\n          const styleBlocks = `\n<link href=\"https://unpkg.com/gridstack@11.3.0/dist/gridstack.min.css\" rel=\"stylesheet\" />\n<style type=\"text/css\">\n*, *::before, *::after {\nbox-sizing: border-box;\n}\n:host { display: block; }\n\n.grid-stack {\nbackground-color: #fafad2;\n}\n.grid-stack-item-content {\nbackground-color: #18bc9c;\n}\n</style>\n`;\n\n          this.shadowRoot.innerHTML = `${styleBlocks}<div class=\"grid-stack\"></div>`;\n          const gridEl = this.shadowRoot.querySelector(\"div\");\n          const items = [\n            {\n              content: \"my first widget\",\n            }, // will default to location (0,0) and 1x1\n            {\n              w: 2,\n              content: \"another longer widget!\",\n            }, // will be placed next at (1,0) and 2x1\n            {\n              content: \"3rd Widget\",\n            },\n          ];\n          const grid = GridStack.init(\n            {\n              disableOneColumnMode: true,\n              draggable: {\n                appendTo: \"parent\",\n              },\n              cellHeight: 100,\n            },\n            gridEl\n          );\n          grid.load(items);\n        }\n      }\n\n      customElements.define(\"demo-gridstack\", HTMLDemoGridStack);\n    </script>\n  </body>\n</html>\n"
  },
  {
    "path": "spec/e2e/html/810-many-columns.css",
    "content": "/* SASS code using https://www.sassmeister.com/\r\n$columns: 60;\r\n@function fixed($float) {\r\n  @return calc(round($float * 1000) / 1000); // total 4-5 digits being %\r\n}\r\n.gs-#{$columns} > .grid-stack-item {\r\n\r\n  width: fixed(calc(100% / $columns));\r\n\r\n  @for $i from 1 through $columns - 1 {\r\n    &[gs-x='#{$i}'] { left: fixed(calc(100% / $columns) * $i); }\r\n    &[gs-w='#{$i+1}'] { width: fixed(calc(100% / $columns) * ($i+1)); }\r\n  }\r\n}\r\n*/\r\n.gs-60 > .grid-stack-item {\r\n  width: 1.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"1\"] {\r\n  left: 1.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"2\"] {\r\n  width: 3.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"2\"] {\r\n  left: 3.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"3\"] {\r\n  width: 5%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"3\"] {\r\n  left: 5%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"4\"] {\r\n  width: 6.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"4\"] {\r\n  left: 6.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"5\"] {\r\n  width: 8.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"5\"] {\r\n  left: 8.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"6\"] {\r\n  width: 10%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"6\"] {\r\n  left: 10%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"7\"] {\r\n  width: 11.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"7\"] {\r\n  left: 11.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"8\"] {\r\n  width: 13.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"8\"] {\r\n  left: 13.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"9\"] {\r\n  width: 15%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"9\"] {\r\n  left: 15%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"10\"] {\r\n  width: 16.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"10\"] {\r\n  left: 16.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"11\"] {\r\n  width: 18.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"11\"] {\r\n  left: 18.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"12\"] {\r\n  width: 20%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"12\"] {\r\n  left: 20%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"13\"] {\r\n  width: 21.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"13\"] {\r\n  left: 21.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"14\"] {\r\n  width: 23.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"14\"] {\r\n  left: 23.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"15\"] {\r\n  width: 25%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"15\"] {\r\n  left: 25%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"16\"] {\r\n  width: 26.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"16\"] {\r\n  left: 26.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"17\"] {\r\n  width: 28.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"17\"] {\r\n  left: 28.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"18\"] {\r\n  width: 30%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"18\"] {\r\n  left: 30%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"19\"] {\r\n  width: 31.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"19\"] {\r\n  left: 31.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"20\"] {\r\n  width: 33.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"20\"] {\r\n  left: 33.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"21\"] {\r\n  width: 35%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"21\"] {\r\n  left: 35%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"22\"] {\r\n  width: 36.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"22\"] {\r\n  left: 36.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"23\"] {\r\n  width: 38.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"23\"] {\r\n  left: 38.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"24\"] {\r\n  width: 40%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"24\"] {\r\n  left: 40%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"25\"] {\r\n  width: 41.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"25\"] {\r\n  left: 41.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"26\"] {\r\n  width: 43.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"26\"] {\r\n  left: 43.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"27\"] {\r\n  width: 45%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"27\"] {\r\n  left: 45%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"28\"] {\r\n  width: 46.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"28\"] {\r\n  left: 46.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"29\"] {\r\n  width: 48.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"29\"] {\r\n  left: 48.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"30\"] {\r\n  width: 50%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"30\"] {\r\n  left: 50%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"31\"] {\r\n  width: 51.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"31\"] {\r\n  left: 51.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"32\"] {\r\n  width: 53.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"32\"] {\r\n  left: 53.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"33\"] {\r\n  width: 55%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"33\"] {\r\n  left: 55%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"34\"] {\r\n  width: 56.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"34\"] {\r\n  left: 56.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"35\"] {\r\n  width: 58.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"35\"] {\r\n  left: 58.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"36\"] {\r\n  width: 60%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"36\"] {\r\n  left: 60%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"37\"] {\r\n  width: 61.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"37\"] {\r\n  left: 61.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"38\"] {\r\n  width: 63.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"38\"] {\r\n  left: 63.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"39\"] {\r\n  width: 65%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"39\"] {\r\n  left: 65%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"40\"] {\r\n  width: 66.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"40\"] {\r\n  left: 66.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"41\"] {\r\n  width: 68.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"41\"] {\r\n  left: 68.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"42\"] {\r\n  width: 70%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"42\"] {\r\n  left: 70%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"43\"] {\r\n  width: 71.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"43\"] {\r\n  left: 71.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"44\"] {\r\n  width: 73.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"44\"] {\r\n  left: 73.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"45\"] {\r\n  width: 75%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"45\"] {\r\n  left: 75%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"46\"] {\r\n  width: 76.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"46\"] {\r\n  left: 76.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"47\"] {\r\n  width: 78.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"47\"] {\r\n  left: 78.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"48\"] {\r\n  width: 80%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"48\"] {\r\n  left: 80%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"49\"] {\r\n  width: 81.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"49\"] {\r\n  left: 81.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"50\"] {\r\n  width: 83.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"50\"] {\r\n  left: 83.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"51\"] {\r\n  width: 85%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"51\"] {\r\n  left: 85%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"52\"] {\r\n  width: 86.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"52\"] {\r\n  left: 86.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"53\"] {\r\n  width: 88.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"53\"] {\r\n  left: 88.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"54\"] {\r\n  width: 90%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"54\"] {\r\n  left: 90%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"55\"] {\r\n  width: 91.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"55\"] {\r\n  left: 91.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"56\"] {\r\n  width: 93.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"56\"] {\r\n  left: 93.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"57\"] {\r\n  width: 95%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"57\"] {\r\n  left: 95%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"58\"] {\r\n  width: 96.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"58\"] {\r\n  left: 96.667%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"59\"] {\r\n  width: 98.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-x=\"59\"] {\r\n  left: 98.333%;\r\n}\r\n.gs-60 > .grid-stack-item[gs-w=\"60\"] {\r\n  width: 100%;\r\n}"
  },
  {
    "path": "spec/e2e/html/810-many-columns.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Many columns demo</title>\n\n  <link rel=\"stylesheet\" href=\"../../../demo/demo.css\"/>\n  <link rel=\"stylesheet\" href=\"810-many-columns.css\"/>\n  <script src=\"../../../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <div class=\"container-fluid\">\n    <h1>Many Columns demo</h1>\n    <div>\n      <a class=\"btn btn-primary\" onClick=\"addNewWidget()\" href=\"#\">Add Widget</a>\n    </div>\n    <br><br>\n    <div class=\"grid-stack\"></div>\n  </div>\n\n  <script type=\"text/javascript\">\n    const COLUMNS = 60; // # of columns, also need to update CSS\n    let count = 0;\n    let options = {\n      column: COLUMNS,\n      cellHeight: 'auto',\n      margin: 1,\n      // staticGrid: true,\n    };\n    let grid = GridStack.init(options);\n\n    grid.batchUpdate();\n    for (; count <= COLUMNS;) grid.addWidget({content: String(count++)});\n    grid.batchUpdate(false);\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/gridstack-engine-spec.ts",
    "content": "import { GridStackEngine } from'../src/gridstack-engine';\nimport { GridStackNode } from'../src/types';\n\ndescribe('gridstack engine:', () => {\n 'use strict';\n  let e: GridStackEngine;\n  let ePriv: any; // cast engine for private vars access\n  let findNode = function(id: string) {\n    return e.nodes.find(n => n.id === id);\n  };\n\n  it('should exist setup function.', () => {\n    expect(GridStackEngine).not.toBeNull();\n    expect(typeof GridStackEngine).toBe('function');\n  });\n\n  describe('test constructor >', () => {\n  \n    it('should be setup properly', () => {\n      ePriv = e = new GridStackEngine();\n      expect(e.column).toEqual(12);\n      expect(e.float).toEqual(false);\n      expect(e.maxRow).toEqual(undefined!);\n      expect(e.nodes).toEqual([]);\n      expect(e.batchMode).toEqual(undefined!);\n      expect(ePriv.onChange).toEqual(undefined);\n    });\n\n    it('should set params correctly.', () => {\n      let fkt = () => { };\n      let arr: any = [1,2,3];\n      ePriv = e = new GridStackEngine({column: 1, onChange:fkt, float:true, maxRow:2, nodes:arr});\n      expect(e.column).toEqual(1);\n      expect(e.float).toBe(true);\n      expect(e.maxRow).toEqual(2);\n      expect(e.nodes).toEqual(arr);\n      expect(e.batchMode).toEqual(undefined);\n      expect(ePriv.onChange).toEqual(fkt);\n    });\n  });\n\n  describe('batch update', () => {\n\n    it('should set float and batchMode when calling batchUpdate.', () => {\n      ePriv = e = new GridStackEngine({float: true});\n      e.batchUpdate();\n      expect(e.float).toBe(true);\n      expect(e.batchMode).toBe(true);\n    });\n  });  \n\n  describe('test prepareNode >', () => {\n\n    beforeAll(() => {\n      ePriv = e = new GridStackEngine();\n    });\n    it('should prepare a node', () => {\n      expect(e.prepareNode({}, false)).toEqual(expect.objectContaining({x: 0, y: 0, h: 1}));\n      expect(e.prepareNode({x: 10}, false)).toEqual(expect.objectContaining({x: 10, y: 0, h: 1}));\n      expect(e.prepareNode({x: -10}, false)).toEqual(expect.objectContaining({x: 0, y: 0, h: 1}));\n      expect(e.prepareNode({y: 10}, false)).toEqual(expect.objectContaining({x: 0, y: 10, h: 1}));\n      expect(e.prepareNode({y: -10}, false)).toEqual(expect.objectContaining({x: 0, y: 0, h: 1}));\n      expect(e.prepareNode({w: 3}, false)).toEqual(expect.objectContaining({x: 0, y: 0, w: 3, h: 1}));\n      expect(e.prepareNode({w: 100}, false)).toEqual(expect.objectContaining({x: 0, y: 0, w: 12, h: 1}));\n      expect(e.prepareNode({w: 0}, false)).toEqual(expect.objectContaining({x: 0, y: 0, h: 1}));\n      expect(e.prepareNode({w: -190}, false)).toEqual(expect.objectContaining({x: 0, y: 0, h: 1}));\n      expect(e.prepareNode({h: 3}, false)).toEqual(expect.objectContaining({x: 0, y: 0, h: 3}));\n      expect(e.prepareNode({h: 0}, false)).toEqual(expect.objectContaining({x: 0, y: 0, h: 1}));\n      expect(e.prepareNode({h: -10}, false)).toEqual(expect.objectContaining({x: 0, y: 0, h: 1}));\n      expect(e.prepareNode({x: 4, w: 10}, false)).toEqual(expect.objectContaining({x: 2, y: 0, w: 10, h: 1}));\n      expect(e.prepareNode({x: 4, w: 10}, true)).toEqual(expect.objectContaining({x: 4, y: 0, w: 8, h: 1}));\n    });\n  });\n\n  describe('sorting of nodes >', () => {\n    beforeAll(() => {\n      ePriv = e = new GridStackEngine();\n      e.nodes = [{x: 7, y: 0}, {x: 4, y: 4}, {x: 9, y: 0}, {x: 0, y: 1}];\n    });\n\n    it('should sort ascending with 12 columns.', () => {\n      e.sortNodes(1);\n      expect(e.nodes).toEqual([{x: 7, y: 0}, {x: 9, y: 0}, {x: 0, y: 1}, {x: 4, y: 4}]);\n    });\n  \n    it('should sort descending with 12 columns.', () => {\n      e.sortNodes(-1);\n      expect(e.nodes).toEqual([{x: 4, y: 4}, {x: 0, y: 1}, {x: 9, y: 0}, {x: 7, y: 0}]);\n    });\n  \n    it('should sort ascending without columns.', () => {\n      ePriv.column = undefined;\n      e.sortNodes(1);\n      expect(e.nodes).toEqual([{x: 7, y: 0}, {x: 9, y: 0}, {x: 0, y: 1}, {x: 4, y: 4}]);\n    });\n  \n    it('should sort descending without columns.', () => {\n      ePriv.column = undefined;\n      e.sortNodes(-1);\n      expect(e.nodes).toEqual([{x: 4, y: 4}, {x: 0, y: 1}, {x: 9, y: 0}, {x: 7, y: 0}]);\n    });\n  \n  });\n  \n  describe('test isAreaEmpty >', () => {\n\n    beforeAll(() => {\n      ePriv = e = new GridStackEngine({float:true});\n      e.nodes = [\n        e.prepareNode({x: 3, y: 2, w: 3, h: 2})\n      ];\n    });\n\n    it('should be true', () => {\n      expect(e.isAreaEmpty(0, 0, 3, 2)).toEqual(true);\n      expect(e.isAreaEmpty(3, 4, 3, 2)).toEqual(true);\n    });\n\n    it('should be false', () => {\n      expect(e.isAreaEmpty(1, 1, 3, 2)).toEqual(false);\n      expect(e.isAreaEmpty(2, 3, 3, 2)).toEqual(false);\n    });\n  });\n\n  describe('test cleanNodes/getDirtyNodes >', () => {\n\n    beforeAll(() => {\n      ePriv = e = new GridStackEngine({float:true});\n      e.nodes = [\n        e.prepareNode({x: 0, y: 0, id: '1', _dirty: true}),\n        e.prepareNode({x: 3, y: 2, w: 3, h: 2, id: '2', _dirty: true}),\n        e.prepareNode({x: 3, y: 7, w: 3, h: 2, id: '3'})\n      ];\n    });\n\n    beforeEach(() => {\n      delete ePriv.batchMode;\n    });\n\n    it('should return all dirty nodes', () => {\n      let nodes = e.getDirtyNodes();\n      expect(nodes.length).toEqual(2);\n      expect(nodes[0].id).toEqual('1');\n      expect(nodes[1].id).toEqual('2');\n    });\n\n    it('should\\'n clean nodes if batchMode true', () => {\n      e.batchMode = true;\n      e.cleanNodes();\n      expect(e.getDirtyNodes().length).toBeGreaterThan(0);\n    });\n\n    it('should clean all dirty nodes', () => {\n      e.cleanNodes();\n      expect(e.getDirtyNodes().length).toEqual(0);\n    });\n  });\n\n  describe('test batchUpdate/commit >', () => {\n    beforeAll(() => {\n      ePriv = e = new GridStackEngine();\n    });\n\n    it('should work on not float grids', () => {\n      expect(e.float).toEqual(false);\n      e.batchUpdate();\n      e.batchUpdate(); // double for code coverage\n      expect(e.batchMode).toBe(true);\n      expect(e.float).toEqual(true);\n      e.batchUpdate(false);\n      e.batchUpdate(false);\n      expect(e.batchMode).not.toBe(true);\n      expect(e.float).not.toBe(true);\n    });\n\n    it('should work on float grids', () => {\n      e.float = true;\n      e.batchUpdate();\n      expect(e.batchMode).toBe(true);\n      expect(e.float).toEqual(true);\n      e.batchUpdate(false);\n      expect(e.batchMode).not.toBe(true);\n      expect(e.float).toEqual(true);\n    });\n  });\n\n  describe('test batchUpdate/commit >', () => {\n\n    beforeAll(() => {\n      ePriv = e = new GridStackEngine({float:true});\n    });\n\n    it('should work on float grids', () => {\n      expect(e.float).toEqual(true);\n      e.batchUpdate();\n      expect(e.batchMode).toBe(true);\n      expect(e.float).toEqual(true);\n      e.batchUpdate(false);\n      expect(e.batchMode).not.toBe(true);\n      expect(e.float).toEqual(true);\n    });\n  });\n\n  describe('test _notify >', () => {\n    let spy;\n\n    beforeEach(() => {\n      spy = {\n        callback: () => {}\n      };\n      vi.spyOn(spy,'callback');\n      ePriv = e = new GridStackEngine({float:true, onChange: spy.callback});\n      e.nodes = [\n        e.prepareNode({x: 0, y: 0, id: '1', _dirty: true}),\n        e.prepareNode({x: 3, y: 2, w: 3, h: 2, id: '2', _dirty: true}),\n        e.prepareNode({x: 3, y: 7, w: 3, h: 2, id: '3'})\n      ];\n    });\n\n    it('should\\'n be called if batchMode true', () => {\n      e.batchMode = true;\n      ePriv._notify();\n      expect(spy.callback).not.toHaveBeenCalled();\n    });\n\n    it('should by called with dirty nodes', () => {\n      ePriv._notify();\n      expect(spy.callback).toHaveBeenCalledWith([e.nodes[0], e.nodes[1]]);\n    });\n\n    it('should by called with extra passed node to be removed', () => {\n      let n1 = {id: -1};\n      ePriv._notify([n1]);\n      expect(spy.callback).toHaveBeenCalledWith([n1, e.nodes[0], e.nodes[1]]);\n    });\n  });\n\n  describe('test _packNodes >', () => {\n    describe('using float:false mode >', () => {\n      beforeEach(() => {\n        ePriv = e = new GridStackEngine({float:false});\n      });\n\n      it('shouldn\\'t pack one node with y coord eq 0', () => {\n        e.nodes = [\n          e.prepareNode({x: 0, y: 0, w:1, h:1, id: '1'}),\n        ];\n        ePriv._packNodes();\n        expect(findNode('1')).toEqual(expect.objectContaining({x: 0, y: 0, h: 1}));\n        expect(findNode('1')!._dirty).toBeFalsy();\n      });\n\n      it('should pack one node correctly', () => {\n        e.nodes = [\n          e.prepareNode({x: 0, y: 1, w:1, h:1, id: '1'}),\n        ];\n        ePriv._packNodes();\n        expect(findNode('1')).toEqual(expect.objectContaining({x: 0, y: 0, _dirty: true}));\n      });\n\n      it('should pack nodes correctly', () => {\n        e.nodes = [\n          e.prepareNode({x: 0, y: 1, w:1, h:1, id: '1'}),\n          e.prepareNode({x: 0, y: 5, w:1, h:1, id: '2'}),\n        ];\n        ePriv._packNodes();\n        expect(findNode('1')).toEqual(expect.objectContaining({x: 0, y: 0, _dirty: true}));\n        expect(findNode('2')).toEqual(expect.objectContaining({x: 0, y: 1, _dirty: true}));\n      });\n  \n      it('should pack reverse nodes correctly', () => {\n        e.nodes = [\n          e.prepareNode({x: 0, y: 5, w:1, h:1, id: '1'}),\n          e.prepareNode({x: 0, y: 1, w:1, h:1, id: '2'}),\n        ];\n        ePriv._packNodes();\n        expect(findNode('2')).toEqual(expect.objectContaining({x: 0, y: 0, _dirty: true}));\n        expect(findNode('1')).toEqual(expect.objectContaining({x: 0, y: 1, _dirty: true}));\n      });\n  \n      it('should respect locked nodes', () => {\n        e.nodes = [\n          e.prepareNode({x: 0, y: 1, w:1, h:1, id: '1', locked: true}),\n          e.prepareNode({x: 0, y: 5, w:1, h:1, id: '2'}),\n        ];\n        ePriv._packNodes();\n        expect(findNode('1')).toEqual(expect.objectContaining({x: 0, y: 1, h: 1}));\n        expect(findNode('1')!._dirty).toBeFalsy();\n        expect(findNode('2')).toEqual(expect.objectContaining({x: 0, y: 2, _dirty: true}));\n      });\n    });\n  });\n\n  describe('test changedPos >', () => {\n    beforeAll(() => {\n      ePriv = e = new GridStackEngine();\n    });\n    it('should return true for changed x', () => {\n      let widget = { x: 1, y: 2, w: 3, h: 4 };\n      expect(e.changedPosConstrain(widget, {x:2, y:2})).toEqual(true);\n    });\n    it('should return true for changed y', () => {\n      let widget = { x: 1, y: 2, w: 3, h: 4 };\n      expect(e.changedPosConstrain(widget, {x:1, y:1})).toEqual(true);\n    });\n    it('should return true for changed width', () => {\n      let widget = { x: 1, y: 2, w: 3, h: 4 };\n      expect(e.changedPosConstrain(widget, {x:2, y:2, w:4, h:4})).toEqual(true);\n    });\n    it('should return true for changed height', () => {\n      let widget = { x: 1, y: 2, w: 3, h: 4 };\n      expect(e.changedPosConstrain(widget, {x:1, y:2, w:3, h:3})).toEqual(true);\n    });\n    it('should return false for unchanged position', () => {\n      let widget = { x: 1, y: 2, w: 3, h: 4 };\n      expect(e.changedPosConstrain(widget, {x:1, y:2, w:3, h:4})).toEqual(false);\n    });\n  });\n\n  describe('test locked widget >', () => {\n    beforeAll(() => {\n      ePriv = e = new GridStackEngine();\n    });\n    it('should add widgets around locked one', () => {\n      let nodes: GridStackNode[] = [\n        {x: 0, y: 1, w: 12, h: 1, locked: true, noMove: true, noResize: true, id: '0'},\n        {x: 1, y: 0, w: 2, h: 3, id: '1'}\n      ];\n      // add locked item\n      e.addNode(nodes[0])\n      expect(findNode('0')).toEqual(expect.objectContaining({x: 0, y: 1, w: 12, h: 1, locked: true}));\n      // add item that moves past locked one\n      e.addNode(nodes[1])\n      expect(findNode('0')).toEqual(expect.objectContaining({x: 0, y: 1, w: 12, h: 1, locked: true}));\n      expect(findNode('1')).toEqual(expect.objectContaining({x: 1, y: 2, h: 3}));\n      // locked item can still be moved directly (what user does)\n      let node0 = findNode('0');\n      expect(e.moveNode(node0!, {y:6})).toEqual(true);\n      expect(findNode('0')).toEqual(expect.objectContaining({x: 0, y: 6, h: 1, locked: true}));\n      // but moves regular one past it\n      let node1 = findNode('1');\n      expect(e.moveNode(node1!, {x:6, y:6})).toEqual(true);\n      expect(node1).toEqual(expect.objectContaining({x: 6, y: 7, w: 2, h: 3}));\n      // but moves regular one before (gravity ON)\n      e.float = false;\n      expect(e.moveNode(node1!, {x:7, y:3})).toEqual(true);\n      expect(node1).toEqual(expect.objectContaining({x: 7, y: 0, w: 2, h: 3}));\n      // but moves regular one before (gravity OFF)\n      e.float = true;\n      expect(e.moveNode(node1!, {x:7, y:3})).toEqual(true);\n      expect(node1).toEqual(expect.objectContaining({x: 7, y: 3, w: 2, h: 3}));\n    });\n  });\n  \n  describe('test columnChanged >', () => {\n    beforeAll(() => {\n    });\n    it('12 to 1 and back', () => {\n      ePriv = e = new GridStackEngine({ column: 12 });\n      // Add two side-by-side components 6+6 = 12 columns\n      const left = e.addNode({ x: 0, y: 0, w: 6, h: 1, id: 'left' });\n      const right = e.addNode({ x: 6, y: 0, w: 6, h: 1, id: 'right' });\n      expect(left).toEqual(expect.objectContaining({x: 0, y: 0, w: 6, h: 1}));\n      expect(right).toEqual(expect.objectContaining({x: 6, y: 0, w: 6, h: 1}));\n      // Resize to 1 column\n      e.column = 1;\n      e.columnChanged(12, 1);\n      expect(left).toEqual(expect.objectContaining({x: 0, y: 0, w: 1, h: 1}));\n      expect(right).toEqual(expect.objectContaining({x: 0, y: 1, w: 1, h: 1}));\n      // Resize back to 12 column\n      e.column = 12;\n      e.columnChanged(1, 12);\n      expect(left).toEqual(expect.objectContaining({x: 0, y: 0, w: 6, h: 1}));\n      expect(right).toEqual(expect.objectContaining({x: 6, y: 0, w: 6, h: 1}));\n    });\n    it('24 column to 1 and back', () => {\n      ePriv = e = new GridStackEngine({ column: 24 });\n      // Add two side-by-side components 12+12 = 24 columns\n      const left = e.addNode({ x: 0, y: 0, w: 12, h: 1, id: 'left' });\n      const right = e.addNode({ x: 12, y: 0, w: 12, h: 1, id: 'right' });\n      expect(left).toEqual(expect.objectContaining({x: 0, y: 0, w: 12, h: 1}));\n      expect(right).toEqual(expect.objectContaining({x: 12, y: 0, w: 12, h: 1}));\n      // Resize to 1 column\n      e.column = 1;\n      e.columnChanged(24, 1);\n      expect(left).toEqual(expect.objectContaining({x: 0, y: 0, w: 1, h: 1}));\n      expect(right).toEqual(expect.objectContaining({x: 0, y: 1, w: 1, h: 1}));\n      // Resize back to 24 column\n      e.column = 24;\n      e.columnChanged(1, 24);\n      expect(left).toEqual(expect.objectContaining({x: 0, y: 0, w: 12, h: 1}));\n      expect(right).toEqual(expect.objectContaining({x: 12, y: 0, w: 12, h: 1}));\n    });\n  });\n\n  describe('test compact >', () => {\n    beforeAll(() => {\n      ePriv = e = new GridStackEngine();\n    });\n    it('do nothing', () => {\n      e.compact();\n    });\n  });\n\n});\n"
  },
  {
    "path": "spec/gridstack-spec.ts",
    "content": "import { GridItemHTMLElement, GridStack, GridStackNode, GridStackWidget } from '../src/gridstack';\nimport { Utils } from '../src/utils';\n\ndescribe('gridstack >', () => {\n  'use strict';\n\n  let grid: GridStack;\n  let grids: GridStack[];\n  let find = function(id: string): GridStackNode {\n    return grid.engine.nodes.find(n => n.id === id)!;\n  };\n  let findEl = function(id: string): GridItemHTMLElement {\n    return find(id).el!;\n  };\n\n  // grid has 4x2 and 4x4 top-left aligned - used on most test cases\n  let gridHTML =\n  '<div class=\"grid-stack\">' +\n  '  <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"0\" gs-w=\"4\" gs-h=\"2\" gs-id=\"gsItem1\" id=\"item1\">' +\n  '    <div class=\"grid-stack-item-content\">item 1 text</div>' +\n  '  </div>' +\n  '  <div class=\"grid-stack-item\" gs-x=\"4\" gs-y=\"0\" gs-w=\"4\" gs-h=\"4\" gs-id=\"gsItem2\" id=\"item2\">' +\n  '    <div class=\"grid-stack-item-content\">item 2 text</div>' +\n  '  </div>' +\n  '</div>';\n  let gridstackHTML =\n  '<div style=\"width: 800px; height: 600px\" id=\"gs-cont\">' + gridHTML + '</div>';\n  let gridstackSmallHTML =\n  '<div style=\"width: 400px; height: 600px\" id=\"gs-cont\">' + gridHTML + '</div>';\n  // empty grid\n  let gridstackEmptyHTML =\n  '<div style=\"width: 800px; height: 600px\" id=\"gs-cont\">' +\n  '  <div class=\"grid-stack\">' +\n  '  </div>' +\n  '</div>';\n  // nested empty grids\n  let gridstackNestedHTML =\n  '<div style=\"width: 800px; height: 600px\" id=\"gs-cont\">' +\n  '  <div class=\"grid-stack\">' +\n  '    <div class=\"grid-stack-item\">' +\n  '      <div class=\"grid-stack-item-content\">item 1</div>' +\n  '      <div class=\"grid-stack-item-content\">' +\n  '         <div class=\"grid-stack sub1\"></div>' +\n  '      </div>' +\n  '    </div>' +\n  '  </div>' +\n  '</div>';\n  // generic widget with no param\n  let widgetHTML = '<div id=\"item3\"><div class=\"grid-stack-item-content\"> hello </div></div>';\n\n  describe('grid.init() / initAll() >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('use selector >', () => {\n      grid = GridStack.init(undefined, '.grid-stack');\n      expect(grid).not.toBe(null);\n    });\n    it('use selector no dot >', () => {\n      grid = GridStack.init(null, 'grid-stack');\n      expect(grid).not.toBe(null);\n    });\n    it('use wrong selector >', () => {\n      grid = GridStack.init(null, 'BAD_SELECTOR_TEST');\n      expect(grid).toEqual(null);\n    });\n    it('initAll use selector >', () => {\n      grids = GridStack.initAll(undefined, '.grid-stack');\n      expect(grids.length).toBe(1);\n    });\n    it('initAll use selector no dot >', () => {\n      grids = GridStack.initAll(undefined, 'grid-stack');\n      expect(grids.length).toBe(1);\n    });\n  });\n\n  describe('grid.setAnimation >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should add class grid-stack-animate to the container. >', () => {\n      grid = GridStack.init({animate: true});\n      expect(grid.el.classList.contains('grid-stack-animate')).toBe(true);\n      grid.el.classList.remove('grid-stack-animate');\n      expect(grid.el.classList.contains('grid-stack-animate')).toBe(false);\n      grid.setAnimation(true);\n      expect(grid.el.classList.contains('grid-stack-animate')).toBe(true);\n    });\n    it('should remove class grid-stack-animate from the container. >', () => {\n      grid = GridStack.init({animate: true});\n      grid.setAnimation(false);\n      expect(grid.el.classList.contains('grid-stack-animate')).toBe(false);\n    });\n  });\n\n  describe('grid._setStaticClass >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should add class grid-stack-static to the container. >', () => {\n      grid = GridStack.init({staticGrid: true});\n      expect(grid.el.classList.contains('grid-stack-static')).toBe(true);\n      grid.setStatic(false);\n      expect(grid.el.classList.contains('grid-stack-static')).toBe(false);\n      grid.setStatic(true);\n      expect(grid.el.classList.contains('grid-stack-static')).toBe(true);\n    });\n    it('should remove class grid-stack-static from the container. >', () => {\n      grid = GridStack.init({staticGrid: false});\n      expect(grid.el.classList.contains('grid-stack-static')).toBe(false);\n      grid.setStatic(true);\n      expect(grid.el.classList.contains('grid-stack-static')).toBe(true);\n    });\n  });\n\n  // Note: Pixel-accurate coordinate tests moved to E2E tests\n  // where real browser layout engines can provide accurate getBoundingClientRect()\n  // describe('grid.getCellFromPixel >', () => {});\n\n  // Note: Exact pixel calculation tests moved to E2E tests\n  // where real browser layout engines can provide accurate offsetWidth\n  // describe('grid.cellWidth >', () => {});\n\n  describe('grid.cellHeight >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should set and get cellHeight correctly >', () => {\n      let cellHeight = 80;\n      let margin = 5;\n      let options = {\n        cellHeight,\n        margin,\n        column: 12\n      };\n      grid = GridStack.init(options);\n      \n      let rows = parseInt(grid.el.getAttribute('gs-current-row'));\n      \n      expect(grid.getRow()).toBe(rows);\n      expect(grid.getCellHeight()).toBe(cellHeight);\n      \n      // Note: Exact pixel height calculation tests moved to E2E tests\n      // where real browser layout engines can provide accurate getComputedStyle() values\n\n      grid.cellHeight( grid.getCellHeight() ); // should be no-op\n      expect(grid.getCellHeight()).toBe(cellHeight);\n\n      cellHeight = 120; // should change\n      grid.cellHeight( cellHeight );\n      expect(grid.getCellHeight()).toBe(cellHeight);\n\n      cellHeight = 20; // should change\n      grid.cellHeight( cellHeight );\n      expect(grid.getCellHeight()).toBe(cellHeight);\n    });\n\n    it('should be square >', () => {\n      grid = GridStack.init({cellHeight: 'auto'});\n      expect(grid.cellWidth()).toBe( grid.getCellHeight());\n    });\n\n  });\n\n  describe('grid.column >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should have no changes >', () => {\n      grid = GridStack.init();\n      expect(grid.getColumn()).toBe(12);\n      grid.column(12);\n      expect(grid.getColumn()).toBe(12);\n    }); \n    it('should set construct CSS class >', () => {\n      grid = GridStack.init({column: 1});\n      expect(grid.el.classList.contains('gs-1')).toBe(true);\n      grid.column(2);\n      expect(grid.el.classList.contains('gs-1')).toBe(false);\n      expect(grid.el.classList.contains('gs-2')).toBe(true);\n    }); \n    it('should set CSS class >', () => {\n      grid = GridStack.init();\n      expect(grid.el.classList.contains('grid-stack')).toBe(true);\n      grid.column(1);\n      expect(grid.el.classList.contains('gs-1')).toBe(true);\n    }); \n    it('should SMALL change column number, no relayout >', () => {\n      let options = {\n        column: 12\n      };\n      grid = GridStack.init(options);\n      let items = Utils.getElements('.grid-stack-item');\n      grid.column(9);\n      expect(grid.getColumn()).toBe(9);\n      items.forEach(el => expect(el.getAttribute('gs-y')).toBe(null));\n      grid.column(12);\n      expect(grid.getColumn()).toBe(12);\n      items.forEach(el => expect(el.getAttribute('gs-y')).toBe(null));\n    });\n    it('no sizing, no moving >', () => {\n      grid = GridStack.init({column: 12});\n      let items = Utils.getElements('.grid-stack-item');\n      grid.column(8, 'none');\n      expect(grid.getColumn()).toBe(8);\n      items.forEach(el => {\n        expect(parseInt(el.getAttribute('gs-w'))).toBe(4);\n        expect(el.getAttribute('gs-y')).toBe(null);\n      });\n    });\n    it('no sizing, but moving down >', () => {\n      grid = GridStack.init({column: 12});\n      let items = Utils.getElements('.grid-stack-item');\n      grid.column(7, 'move');\n      expect(grid.getColumn()).toBe(7);\n      items.forEach(el => expect(parseInt(el.getAttribute('gs-w'))).toBe(4));\n      expect(items[0].getAttribute('gs-y')).toBe(null);\n      expect(parseInt(items[1].getAttribute('gs-y'))).toBe(2);\n    });\n    it('should change column number and re-layout items >', () => {\n      let options = {\n        column: 12,\n        float: true\n      };\n      grid = GridStack.init(options);\n      let el1 = document.getElementById('item1')\n      let el2 = document.getElementById('item2')\n\n      // items start at 4x2 and 4x4\n      expect(el1.getAttribute('gs-x')).toBe(null);\n      expect(el1.getAttribute('gs-y')).toBe(null);\n      expect(parseInt(el1.getAttribute('gs-w'))).toBe(4);\n      expect(parseInt(el1.getAttribute('gs-h'))).toBe(2);\n\n      expect(parseInt(el2.getAttribute('gs-x'))).toBe(4);\n      expect(el2.getAttribute('gs-y')).toBe(null);\n      expect(parseInt(el2.getAttribute('gs-w'))).toBe(4);\n      expect(parseInt(el2.getAttribute('gs-h'))).toBe(4);\n\n      // 1 column will have item1, item2\n      grid.column(1);\n      expect(grid.getColumn()).toBe(1);\n      expect(el1.getAttribute('gs-x')).toBe(null);\n      expect(el1.getAttribute('gs-y')).toBe(null);\n      expect(el1.getAttribute('gs-w')).toBe(null);\n      expect(parseInt(el1.getAttribute('gs-h'))).toBe(2);\n\n      expect(el2.getAttribute('gs-x')).toBe(null);\n      expect(parseInt(el2.getAttribute('gs-y'))).toBe(2);\n      expect(el2.getAttribute('gs-w')).toBe(null);\n      expect(parseInt(el2.getAttribute('gs-h'))).toBe(4);\n\n      // add default 1x1 item to the end (1 column)\n      let el3 = grid.addWidget({content:'new'});\n      expect(el3).not.toBe(null);\n      expect(el3.getAttribute('gs-x')).toBe(null);\n      expect(parseInt(el3.getAttribute('gs-y'))).toBe(6);\n      expect(el3.getAttribute('gs-w')).toBe(null);\n      expect(el3.getAttribute('gs-h')).toBe(null);\n\n      // back to 12 column and initial layout (other than new item3)\n      grid.column(12);\n      expect(grid.getColumn()).toBe(12);\n      expect(el1.getAttribute('gs-x')).toBe(null);\n      expect(el1.getAttribute('gs-y')).toBe(null);\n      expect(parseInt(el1.getAttribute('gs-w'))).toBe(4);\n      expect(parseInt(el1.getAttribute('gs-h'))).toBe(2);\n\n      expect(parseInt(el2.getAttribute('gs-x'))).toBe(4);\n      expect(el2.getAttribute('gs-y')).toBe(null);\n      expect(parseInt(el2.getAttribute('gs-w'))).toBe(4);\n      expect(parseInt(el2.getAttribute('gs-h'))).toBe(4);\n\n      // TODO: we don't remembers autoPlacement (cleared multiple places)\n      // expect(parseInt(el3.getAttribute('gs-x'))).toBe(8);\n      // expect(el3.getAttribute('gs-y')).toBe(null);\n      expect(el3.getAttribute('gs-x')).toBe(null);\n      expect(parseInt(el3.getAttribute('gs-y'))).toBe(6);\n      expect(el3.getAttribute('gs-w')).toBe(null);\n      expect(el3.getAttribute('gs-h')).toBe(null);\n\n      // back to 1 column\n      grid.column(1);\n      expect(grid.getColumn()).toBe(1);\n      expect(el1.getAttribute('gs-x')).toBe(null);\n      expect(el1.getAttribute('gs-y')).toBe(null);\n      expect(el1.getAttribute('gs-w')).toBe(null);\n      expect(parseInt(el1.getAttribute('gs-h'))).toBe(2);\n\n      expect(el2.getAttribute('gs-x')).toBe(null);\n      expect(parseInt(el2.getAttribute('gs-y'))).toBe(2);\n      expect(el2.getAttribute('gs-w')).toBe(null);\n      expect(parseInt(el2.getAttribute('gs-h'))).toBe(4);\n\n      expect(el3.getAttribute('gs-x')).toBe(null);\n      expect(parseInt(el3.getAttribute('gs-y'))).toBe(6);\n      expect(el3.getAttribute('gs-w')).toBe(null);\n      expect(el3.getAttribute('gs-h')).toBe(null);\n\n      // move item2 to beginning to [3][1][2] vertically\n      grid.update(el3, {x:0, y:0});\n      expect(el3.getAttribute('gs-x')).toBe(null);\n      expect(el3.getAttribute('gs-y')).toBe(null);\n      expect(el3.getAttribute('gs-w')).toBe(null);\n      expect(el3.getAttribute('gs-h')).toBe(null);\n\n      expect(el1.getAttribute('gs-x')).toBe(null);\n      expect(parseInt(el1.getAttribute('gs-y'))).toBe(1);\n      expect(el1.getAttribute('gs-w')).toBe(null);\n      expect(parseInt(el1.getAttribute('gs-h'))).toBe(2);\n\n      expect(el2.getAttribute('gs-x')).toBe(null);\n      expect(parseInt(el2.getAttribute('gs-y'))).toBe(3);\n      expect(el2.getAttribute('gs-w')).toBe(null);\n      expect(parseInt(el2.getAttribute('gs-h'))).toBe(4);\n\n      // back to 12 column, el3 to be beginning still, but [1][2] to be in 1 columns still but wide 4x2 and 4x still\n      grid.column(12);\n      expect(grid.getColumn()).toBe(12);\n      expect(el3.getAttribute('gs-x')).toBe(null); // 8 TEST WHY\n      expect(el3.getAttribute('gs-y')).toBe(null);\n      expect(el3.getAttribute('gs-w')).toBe(null);\n      expect(el3.getAttribute('gs-h')).toBe(null);\n\n      expect(el1.getAttribute('gs-x')).toBe(null);\n      expect(parseInt(el1.getAttribute('gs-y'))).toBe(1);\n      expect(parseInt(el1.getAttribute('gs-w'))).toBe(4);\n      expect(parseInt(el1.getAttribute('gs-h'))).toBe(2);\n\n      expect(parseInt(el2.getAttribute('gs-x'))).toBe(4);\n      expect(parseInt(el2.getAttribute('gs-y'))).toBe(1);\n      expect(parseInt(el2.getAttribute('gs-w'))).toBe(4);\n      expect(parseInt(el2.getAttribute('gs-h'))).toBe(4);\n\n      // 2 column will have item1, item2, item3 in 1 column still but half the width\n      grid.column(1); // test convert from small, should use 12 layout still\n      grid.column(2);\n      expect(grid.getColumn()).toBe(2);\n\n      expect(el3.getAttribute('gs-x')).toBe(null); // 1 TEST WHY\n      expect(el3.getAttribute('gs-y')).toBe(null);\n      expect(el3.getAttribute('gs-w')).toBe(null); // 1 as we scaled from 12 columns\n      expect(el3.getAttribute('gs-h')).toBe(null);\n\n      expect(el1.getAttribute('gs-x')).toBe(null);\n      expect(parseInt(el1.getAttribute('gs-y'))).toBe(1);\n      expect(el1.getAttribute('gs-w')).toBe(null);\n      expect(parseInt(el1.getAttribute('gs-h'))).toBe(2);\n\n      expect(parseInt(el2.getAttribute('gs-x'))).toBe(1);\n      expect(parseInt(el2.getAttribute('gs-y'))).toBe(1);\n      expect(el2.getAttribute('gs-w')).toBe(null);\n      expect(parseInt(el2.getAttribute('gs-h'))).toBe(4);\n    });\n  });\n\n  describe('grid.column larger layout >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackEmptyHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n\n    it('24 layout in 12 column to 1 back 12 then 24 >', () => {\n      const children: GridStackWidget[] = [{ x: 0, y: 0, w: 12, h: 1, id: 'left' }, { x: 12, y: 0, w: 12, h: 1, id: 'right' }];\n      children.forEach(c => c.content = c.id);\n\n      grid = GridStack.init({children});\n      const left = find('left');\n      const right = find('right');\n\n      // side-by-side components 12+12 = 24 columns but only have 12!\n      expect(left).toEqual(expect.objectContaining({x: 0, y: 0, w: 12}));\n      expect(right).toEqual(expect.objectContaining({x: 0, y: 1, w: 12}));\n      // Resize to 1 column\n      grid.column(1);\n      expect(left).toEqual(expect.objectContaining({x: 0, y: 0, w: 1}));\n      expect(right).toEqual(expect.objectContaining({x: 0, y: 1, w: 1}));\n      // Resize back to 12 column\n      grid.column(12);\n      expect(left).toEqual(expect.objectContaining({x: 0, y: 0, w: 12}));\n      expect(right).toEqual(expect.objectContaining({x: 0, y: 1, w: 12}));\n      // Resize to 24 column\n      grid.column(24);\n      expect(left).toEqual(expect.objectContaining({x: 0, y: 0, w: 12}));\n      expect(right).toEqual(expect.objectContaining({x: 12, y: 0, w: 12}));\n    });\n    it('24 column to 12, 1 back 12,24 >', () => {\n      const children: GridStackWidget[] = [{ x: 0, y: 0, w: 12, h: 1, id: 'left' }, { x: 12, y: 0, w: 12, h: 1, id: 'right' }];\n      children.forEach(c => c.content = c.id);\n\n      grid = GridStack.init({column:24, children});\n      const left = find('left');\n      const right = find('right');\n\n      // side-by-side components 12+12 = 24 columns\n      expect(left).toEqual(expect.objectContaining({x: 0, y: 0, w: 12}));\n      expect(right).toEqual(expect.objectContaining({x: 12, y: 0, w: 12}));\n      // Resize to 12 column\n      grid.column(12);\n      expect(left).toEqual(expect.objectContaining({x: 0, y: 0, w: 6}));\n      expect(right).toEqual(expect.objectContaining({x: 6, y: 0, w: 6}));\n      // Resize to 1 column\n      grid.column(1);\n      expect(left).toEqual(expect.objectContaining({x: 0, y: 0, w: 1}));\n      expect(right).toEqual(expect.objectContaining({x: 0, y: 1, w: 1}));\n      // back to 12 column\n      grid.column(12);\n      expect(left).toEqual(expect.objectContaining({x: 0, y: 0, w: 6}));\n      expect(right).toEqual(expect.objectContaining({x: 6, y: 0, w: 6}));\n      // back to 24 column\n      grid.column(24);\n      expect(left).toEqual(expect.objectContaining({x: 0, y: 0, w: 12}));\n      expect(right).toEqual(expect.objectContaining({x: 12, y: 0, w: 12}));\n    });\n\n  });\n\n  // describe('oneColumnModeDomSort >', () => {\n  //   beforeEach(() => {\n  //     document.body.insertAdjacentHTML('afterbegin', gridstackEmptyHTML);\n  //   });\n  //   afterEach(() => {\n  //     document.body.removeChild(document.getElementById('gs-cont'));\n  //   });\n  //   it('should support default going to 1 column >', () => {\n  //     let options = {\n  //       column: 12,\n  //       float: true\n  //     };\n  //     grid = GridStack.init(options);\n  //     grid.batchUpdate();\n  //     grid.batchUpdate();\n  //     let el1 = grid.addWidget({w:1, h:1});\n  //     let el2 = grid.addWidget({x:2, y:0, w:2, h:1});\n  //     let el3 = grid.addWidget({x:1, y:0, w:1, h:2});\n  //     grid.batchUpdate(false);\n  //     grid.batchUpdate(false);\n      \n  //     // items are item1[1x1], item3[1x1], item2[2x1]\n  //     expect(el1.getAttribute('gs-x')).toBe(null);\n  //     expect(el1.getAttribute('gs-y')).toBe(null);\n  //     expect(el1.getAttribute('gs-w')).toBe(null);\n  //     expect(el1.getAttribute('gs-h')).toBe(null);\n\n  //     expect(parseInt(el3.getAttribute('gs-x'))).toBe(1);\n  //     expect(el3.getAttribute('gs-y')).toBe(null);\n  //     expect(el3.getAttribute('gs-w')).toBe(null);\n  //     expect(parseInt(el3.getAttribute('gs-h'))).toBe(2);\n\n  //     expect(parseInt(el2.getAttribute('gs-x'))).toBe(2);\n  //     expect(el2.getAttribute('gs-y')).toBe(null);\n  //     expect(parseInt(el2.getAttribute('gs-w'))).toBe(2);\n  //     expect(el2.getAttribute('gs-h')).toBe(null);\n\n  //     // items are item1[1x1], item3[1x2], item2[1x1] in 1 column\n  //     grid.column(1);\n  //     expect(el1.getAttribute('gs-x')).toBe(null);\n  //     expect(el1.getAttribute('gs-y')).toBe(null);\n  //     expect(el1.getAttribute('gs-w')).toBe(null);\n  //     expect(el1.getAttribute('gs-h')).toBe(null);\n\n  //     expect(el3.getAttribute('gs-x')).toBe(null);\n  //     expect(parseInt(el3.getAttribute('gs-y'))).toBe(1);\n  //     expect(el3.getAttribute('gs-w')).toBe(null);\n  //     expect(parseInt(el3.getAttribute('gs-h'))).toBe(2);\n\n  //     expect(el2.getAttribute('gs-x')).toBe(null);\n  //     expect(parseInt(el2.getAttribute('gs-y'))).toBe(3);\n  //     expect(el2.getAttribute('gs-w')).toBe(null);\n  //     expect(el2.getAttribute('gs-h')).toBe(null);\n  //   });\n  //   it('should support oneColumnModeDomSort ON going to 1 column >', () => {\n  //     let options = {\n  //       column: 12,\n  //       oneColumnModeDomSort: true,\n  //       float: true\n  //     };\n  //     grid = GridStack.init(options);\n  //     let el1 = grid.addWidget({w:1, h:1});\n  //     let el2 = grid.addWidget({x:2, y:0, w:2, h:1});\n  //     let el3 = grid.addWidget({x:1, y:0, w:1, h:2});\n\n  //     // items are item1[1x1], item3[1x1], item2[2x1]\n  //     expect(el1.getAttribute('gs-x')).toBe(null);\n  //     expect(el1.getAttribute('gs-y')).toBe(null);\n  //     expect(el1.getAttribute('gs-w')).toBe(null);\n  //     expect(el1.getAttribute('gs-h')).toBe(null);\n\n  //     expect(parseInt(el3.getAttribute('gs-x'))).toBe(1);\n  //     expect(el3.getAttribute('gs-y')).toBe(null);\n  //     expect(el3.getAttribute('gs-w')).toBe(null);\n  //     expect(parseInt(el3.getAttribute('gs-h'))).toBe(2);\n\n  //     expect(parseInt(el2.getAttribute('gs-x'))).toBe(2);\n  //     expect(el2.getAttribute('gs-y')).toBe(null);\n  //     expect(parseInt(el2.getAttribute('gs-w'))).toBe(2);\n  //     expect(el2.getAttribute('gs-h')).toBe(null);\n\n  //     // items are item1[1x1], item2[1x1], item3[1x2] in 1 column dom ordered\n  //     grid.column(1);\n  //     expect(el1.getAttribute('gs-x')).toBe(null);\n  //     expect(el1.getAttribute('gs-y')).toBe(null);\n  //     expect(el1.getAttribute('gs-w')).toBe(null);\n  //     expect(el1.getAttribute('gs-h')).toBe(null);\n\n  //     expect(el2.getAttribute('gs-x')).toBe(null);\n  //     expect(parseInt(el2.getAttribute('gs-y'))).toBe(1);\n  //     expect(el2.getAttribute('gs-w')).toBe(null);\n  //     expect(el2.getAttribute('gs-h')).toBe(null);\n\n  //     expect(el3.getAttribute('gs-x')).toBe(null);\n  //     expect(parseInt(el3.getAttribute('gs-y'))).toBe(2);\n  //     expect(el3.getAttribute('gs-w')).toBe(null);\n  //     expect(parseInt(el3.getAttribute('gs-h'))).toBe(2);\n  //   });\n  // });\n\n  // describe('disableOneColumnMode >', () => {\n  //   beforeEach(() => {\n  //     document.body.insertAdjacentHTML('afterbegin', gridstackSmallHTML); // smaller default to 1 column\n  //   });\n  //   afterEach(() => {\n  //     document.body.removeChild(document.getElementById('gs-cont'));\n  //   });\n  //   it('should go to 1 column >', () => {\n  //     grid = GridStack.init();\n  //     expect(grid.getColumn()).toBe(1);\n  //   });\n  //   it('should go to 1 column with large minW >', () => {\n  //     grid = GridStack.init({oneColumnSize: 1000});\n  //     expect(grid.getColumn()).toBe(1);\n  //   });\n  //   it('should stay at 12 with minW >', () => {\n  //     grid = GridStack.init({oneColumnSize: 300});\n  //     expect(grid.getColumn()).toBe(12);\n  //   });\n  //   it('should stay at 12 column >', () => {\n  //     grid = GridStack.init({disableOneColumnMode: true});\n  //     expect(grid.getColumn()).toBe(12);\n  //   });\n  // });\n\n  describe('grid.minRow >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should default to row 0 when empty >', () => {\n      let options = {};\n      grid = GridStack.init(options);\n      expect(grid.getRow()).toBe(4);\n      expect(grid.opts.minRow).toBe(0);\n      expect(grid.opts.maxRow).toBe(0);\n      grid.removeAll();\n      expect(grid.getRow()).toBe(0);\n    });\n    it('should default to row 2 when empty >', () => {\n      let options = {minRow: 2};\n      grid = GridStack.init(options);\n      expect(grid.getRow()).toBe(4);\n      expect(grid.opts.minRow).toBe(2);\n      expect(grid.opts.maxRow).toBe(0);\n      grid.removeAll();\n      expect(grid.engine.getRow()).toBe(0);\n      expect(grid.getRow()).toBe(2);\n    });\n    it('should set min = max = 3 rows >', () => {\n      let options = {row: 3};\n      grid = GridStack.init(options);\n      expect(grid.getRow()).toBe(3); // shrink elements to fit maxRow!\n      expect(grid.opts.minRow).toBe(3);\n      expect(grid.opts.maxRow).toBe(3);\n      grid.removeAll();\n      expect(grid.engine.getRow()).toBe(0);\n      expect(grid.getRow()).toBe(3);\n    });\n    it('willItFit() >', () => {\n      // default 4x2 and 4x4 so anything pushing more than 1 will fail\n      grid = GridStack.init({maxRow: 5});\n      expect(grid.willItFit({x:0, y:0, w:1, h:1})).toBe(true);\n      expect(grid.willItFit({x:0, y:0, w:1, h:3})).toBe(true);\n      expect(grid.willItFit({x:0, y:0, w:1, h:4})).toBe(false);\n      expect(grid.willItFit({x:0, y:0, w:12, h:1})).toBe(true);\n      expect(grid.willItFit({x:0, y:0, w:12, h:2})).toBe(false);\n    });\n    it('willItFit() not modifying node #1687 >', () => {\n      // default 4x2 and 4x4 so anything pushing more than 1 will fail\n      grid = GridStack.init({maxRow: 5});\n      let node: GridStackNode = {x:0, y:0, w:1, h:1, _id: 1, _temporaryRemoved: true};\n      expect(grid.willItFit(node)).toBe(true);\n      expect(node._temporaryRemoved).toBe(true);\n      expect(node._id).toBe(1);\n    });\n\n  });\n\n  describe('grid attributes >', () => {\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should have row attr >', () => {\n      let HTML = \n        '<div style=\"w: 800px; h: 600px\" id=\"gs-cont\">' +\n        '  <div class=\"grid-stack\" gs-row=\"4\" gs-current-height=\"1\"></div>' + // old attr current-height\n        '</div>';\n      document.body.insertAdjacentHTML('afterbegin', HTML);\n      grid = GridStack.init();\n      expect(grid.getRow()).toBe(4);\n      expect(grid.opts.minRow).toBe(4);\n      expect(grid.opts.maxRow).toBe(4);\n      grid.addWidget({h: 6});\n      expect(grid.engine.getRow()).toBe(4);\n      expect(grid.getRow()).toBe(4);\n    });\n  });\n\n  describe('grid.min/max width/height >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should set gs-min-w to 2. >', () => {\n      grid = GridStack.init();\n      let items: GridItemHTMLElement[] = Utils.getElements('.grid-stack-item');\n      items.forEach(el => grid.update(el, {minW: 2, maxW: 3, minH: 4, maxH: 5}));\n      items.forEach(el => {\n        expect(el.gridstackNode!.minW).toBe(2);\n        expect(el.gridstackNode!.maxW).toBe(3);\n        expect(el.gridstackNode!.minH).toBe(4);\n        expect(el.gridstackNode!.maxH).toBe(5);\n        expect(el.getAttribute('gs-min-w')).toBe(null);\n        expect(el.getAttribute('gs-max-w')).toBe(null);\n        expect(el.getAttribute('gs-min-h')).toBe(null);\n        expect(el.getAttribute('gs-max-h')).toBe(null);\n      });\n      // remove all constrain\n      grid.update('grid-stack-item', {minW: 0, maxW: null, minH: undefined, maxH: 0});\n      items.forEach(el => {\n        expect(el.gridstackNode!.minW).toBe(undefined);\n        expect(el.gridstackNode!.maxW).toBe(undefined);\n        expect(el.gridstackNode!.minH).toBe(undefined);\n        expect(el.gridstackNode!.maxH).toBe(undefined);\n        expect(el.getAttribute('gs-min-w')).toBe(null);\n        expect(el.getAttribute('gs-max-w')).toBe(null);\n        expect(el.getAttribute('gs-min-h')).toBe(null);\n        expect(el.getAttribute('gs-max-h')).toBe(null);\n      });\n    });\n  });\n\n  describe('grid.isAreaEmpty >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should set return false. >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5\n      };\n      grid = GridStack.init(options);\n      let shouldBeFalse = grid.isAreaEmpty(1, 1, 1, 1);\n      expect(shouldBeFalse).toBe(false);\n    });\n    it('should set return true. >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5\n      };\n      grid = GridStack.init(options);\n      let shouldBeTrue = grid.isAreaEmpty(5, 5, 1, 1);\n      expect(shouldBeTrue).toBe(true);\n    });\n  });\n\n  describe('grid.removeAll >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should remove all children by default >', () => {\n      grid = GridStack.init();\n      grid.removeAll();\n      expect(grid.engine.nodes).toEqual([]);\n      expect(document.getElementById('item1')).toBe(null);\n    });\n    it('should remove all children >', () => {\n      grid = GridStack.init();\n      grid.removeAll(true);\n      expect(grid.engine.nodes).toEqual([]);\n      expect(document.getElementById('item1')).toBe(null);\n    });\n    it('should remove gridstack part, leave DOM behind >', () => {\n      grid = GridStack.init();\n      grid.removeAll(false);\n      expect(grid.engine.nodes).toEqual([]);\n      expect(document.getElementById('item1')).not.toBe(null);\n    });\n  });\n\n  describe('grid.removeWidget >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should remove first item (default), then second (false) >', () => {\n      grid = GridStack.init();\n      expect(grid.engine.nodes.length).toEqual(2);\n\n      let el1 = document.getElementById('item1');\n      expect(el1).not.toBe(null);\n      grid.removeWidget(el1);\n      expect(grid.engine.nodes.length).toEqual(1);\n      expect(document.getElementById('item1')).toBe(null);\n      expect(document.getElementById('item2')).not.toBe(null);\n\n      let el2 = document.getElementById('item2');\n      grid.removeWidget(el2, false);\n      expect(grid.engine.nodes.length).toEqual(0);\n      expect(document.getElementById('item2')).not.toBe(null);\n    });\n  });\n\n  describe('grid method _packNodes with float >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should allow same x, y coordinates for widgets. >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5,\n        float: true\n      };\n      grid = GridStack.init(options);\n      let items = Utils.getElements('.grid-stack-item');\n      items.forEach(oldEl => {\n        let el = grid.makeWidget(oldEl);\n        expect(oldEl.getAttribute('gs-x')).toBe(el.getAttribute('gs-x'));\n        expect(oldEl.getAttribute('gs-y')).toBe(el.getAttribute('gs-y'));\n      })\n    });\n    it('should not allow same x, y coordinates for widgets. >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5\n      };\n      grid = GridStack.init(options);\n      let items = Utils.getElements('.grid-stack-item') as GridItemHTMLElement[];\n      items.forEach(oldEl => {\n        let el = oldEl.cloneNode(true) as GridItemHTMLElement;\n        el = grid.makeWidget(el);\n        expect(el.gridstackNode?.x).not.toBe(oldEl.gridstackNode?.x);\n      });\n    });\n  });\n\n  describe('grid method addWidget with all parameters >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should keep all widget options the same (autoPosition off >', () => {\n      grid = GridStack.init({float: true});;\n      let w = grid.addWidget({x: 6, y:7, w:2, h:3, autoPosition:false,\n        minW:1, maxW:4, minH:2, maxH:5, id:'coolWidget'});\n      \n      expect(parseInt(w.getAttribute('gs-x'))).toBe(6);\n      expect(parseInt(w.getAttribute('gs-y'))).toBe(7);\n      expect(parseInt(w.getAttribute('gs-w'))).toBe(2);\n      expect(parseInt(w.getAttribute('gs-h'))).toBe(3);\n      expect(w.getAttribute('gs-auto-position')).toBe(null);\n      expect(w.getAttribute('gs-id')).toBe('coolWidget');\n\n      // should move widget to top with float=false\n      expect(grid.getFloat()).toBe(true);\n      grid.float(false);\n      expect(grid.getFloat()).toBe(false);\n      expect(parseInt(w.getAttribute('gs-x'))).toBe(6);\n      expect(parseInt(w.getAttribute('gs-y'))).toBe(4); // <--- from 7 to 4 below second original widget\n      expect(parseInt(w.getAttribute('gs-w'))).toBe(2);\n      expect(parseInt(w.getAttribute('gs-h'))).toBe(3);\n      expect(w.getAttribute('gs-auto-position')).toBe(null);\n      expect(w.getAttribute('gs-id')).toBe('coolWidget');\n\n      // should not move again (no-op)\n      grid.float(true);\n      expect(grid.getFloat()).toBe(true);\n      expect(parseInt(w.getAttribute('gs-x'))).toBe(6);\n      expect(parseInt(w.getAttribute('gs-y'))).toBe(4);\n      expect(parseInt(w.getAttribute('gs-w'))).toBe(2);\n      expect(parseInt(w.getAttribute('gs-h'))).toBe(3);\n      expect(w.getAttribute('gs-auto-position')).toBe(null);\n      expect(w.getAttribute('gs-id')).toBe('coolWidget');\n    });\n  });\n\n  describe('grid method addWidget with autoPosition true >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should change x, y coordinates for widgets. >', () => {\n      grid = GridStack.init({float: true});\n      let w = grid.addWidget({x:9, y:7, w:2, h:3, autoPosition:true});\n      \n      expect(parseInt(w.getAttribute('gs-x'), 10)).not.toBe(9);\n      expect(parseInt(w.getAttribute('gs-y'), 10)).not.toBe(7);\n    });\n  });\n\n  describe('grid method addWidget with widget options >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should autoPosition (missing X,Y) >', () => {\n      grid = GridStack.init();\n      let w = grid.addWidget({h: 2, id: 'optionWidget'});\n      \n      expect(parseInt(w.getAttribute('gs-x'))).toBe(8);\n      expect(w.getAttribute('gs-y')).toBe(null);\n      expect(w.getAttribute('gs-w')).toBe(null);\n      expect(parseInt(w.getAttribute('gs-h'))).toBe(2);\n      // expect(w.getAttribute('gs-auto-position')).toBe('true');\n      expect(w.getAttribute('gs-id')).toBe('optionWidget');\n    });\n    it('should autoPosition (missing X) >', () => {\n      grid = GridStack.init();\n      let w = grid.addWidget({y: 9, h: 2, id: 'optionWidget'});\n      \n      expect(parseInt(w.getAttribute('gs-x'))).toBe(8);\n      expect(w.getAttribute('gs-y')).toBe(null);\n      expect(w.getAttribute('gs-w')).toBe(null);\n      expect(parseInt(w.getAttribute('gs-h'))).toBe(2);\n      // expect(w.getAttribute('gs-auto-position')).toBe('true');\n      expect(w.getAttribute('gs-id')).toBe('optionWidget');\n    });\n    it('should autoPosition (missing Y) >', () => {\n      grid = GridStack.init();\n      let w = grid.addWidget({x: 9, h: 2, id: 'optionWidget'});\n      \n      expect(parseInt(w.getAttribute('gs-x'))).toBe(8);\n      expect(w.getAttribute('gs-y')).toBe(null);\n      expect(w.getAttribute('gs-w')).toBe(null);\n      expect(parseInt(w.getAttribute('gs-h'))).toBe(2);\n      // expect(w.getAttribute('gs-auto-position')).toBe('true');\n      expect(w.getAttribute('gs-id')).toBe('optionWidget');\n    });\n    it('should autoPosition (correct X, missing Y) >', () => {\n      grid = GridStack.init();\n      let w = grid.addWidget({x: 8, h: 2, id: 'optionWidget'});\n      \n      expect(parseInt(w.getAttribute('gs-x'))).toBe(8);\n      expect(w.getAttribute('gs-y')).toBe(null);\n      expect(w.getAttribute('gs-w')).toBe(null);\n      expect(parseInt(w.getAttribute('gs-h'))).toBe(2);\n      // expect(w.getAttribute('gs-auto-position')).toBe('true');\n      expect(w.getAttribute('gs-id')).toBe('optionWidget');\n    });\n    it('should autoPosition (empty options) >', () => {\n      grid = GridStack.init();\n      let w = grid.addWidget({ });\n      \n      expect(parseInt(w.getAttribute('gs-x'))).toBe(8);\n      expect(w.getAttribute('gs-y')).toBe(null);\n      expect(w.getAttribute('gs-w')).toBe(null);\n      expect(w.getAttribute('gs-h')).toBe(null);\n      // expect(w.getAttribute('gs-auto-position')).toBe('true');\n    });\n\n  });\n\n  describe('addWidget() >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('bad string options should use default >', () => {\n      grid = GridStack.init();\n      let w = grid.addWidget({x: 'foo', y: null, w: 'bar', h: ''} as any);\n      \n      expect(parseInt(w.getAttribute('gs-x'))).toBe(8);\n      expect(w.getAttribute('gs-y')).toBe(null);\n      expect(w.getAttribute('gs-w')).toBe(null);\n      expect(w.getAttribute('gs-h')).toBe(null);\n    });\n    it('makeWidget attr should be retained >', () => { // #1276\n      grid = GridStack.init({float: true});\n      const d = document.createElement('div');\n      d.innerHTML = '<div class=\"grid-stack-item\" gs-w=\"3\" gs-max-w=\"4\" gs-id=\"gsfoo\" id=\"foo\"><div class=\"grid-stack-item-content\">foo content</div></div>';\n      grid.el.appendChild(d.firstChild);\n      let w = grid.makeWidget('foo');\n      expect(parseInt(w.getAttribute('gs-x'))).toBe(8);\n      expect(w.getAttribute('gs-y')).toBe(null);\n      expect(parseInt(w.getAttribute('gs-w'))).toBe(3);\n      expect(w.gridstackNode.maxW).toBe(4);\n      expect(w.getAttribute('gs-h')).toBe(null);\n      expect(w.getAttribute('gs-id')).toBe('gsfoo');\n    });\n    it('makeWidget width option override >', () => {\n      grid = GridStack.init({float: true});\n      const d = document.createElement('div');\n      d.innerHTML = '<div class=\"grid-stack-item\" gs-w=\"3\" gs-max-w=\"4\" gs-id=\"gsfoo\" id=\"foo\"><div class=\"grid-stack-item-content\">foo content</div></div>';\n      grid.el.appendChild(d.firstChild);\n      let w = grid.makeWidget('foo', {x:null, y:null, w:2});\n      \n      expect(parseInt(w.getAttribute('gs-x'))).toBe(8);\n      expect(w.getAttribute('gs-y')).toBe(null);\n      expect(parseInt(w.getAttribute('gs-w'))).toBe(2);\n      expect(w.getAttribute('gs-h')).toBe(null);\n    });\n  });\n\n  describe('makeWidget() >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackEmptyHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('passing element >', () => {\n      grid = GridStack.init();\n      let doc = document.implementation.createHTMLDocument();\n      doc.body.innerHTML = '<div><div class=\"grid-stack-item-content\"></div></div>';\n      let el = doc.body.children[0] as HTMLElement;\n      grid.el.appendChild(el);\n      let w = grid.makeWidget(el);\n      expect(w.getAttribute('gs-x')).toBe(null);\n    });\n    it('passing element float=true >', () => {\n      grid = GridStack.init({float: true});\n      let doc = document.implementation.createHTMLDocument();\n      doc.body.innerHTML = '<div><div class=\"grid-stack-item-content\"></div></div>';\n      let el = doc.body.children[0] as HTMLElement;\n      grid.el.appendChild(el);\n      let w = grid.makeWidget(el);\n      expect(w.getAttribute('gs-x')).toBe(null);\n    });\n    it('passing class >', () => {\n      grid = GridStack.init();\n      let doc = document.implementation.createHTMLDocument();\n      doc.body.innerHTML = '<div class=\"item\"><div class=\"grid-stack-item-content\"></div></div>';\n      let el = doc.body.children[0] as HTMLElement;\n      grid.el.appendChild(el);\n      let w = grid.makeWidget('.item');\n      expect(w.getAttribute('gs-x')).toBe(null);\n    });\n    it('passing class no dot >', () => {\n      grid = GridStack.init();\n      let doc = document.implementation.createHTMLDocument();\n      doc.body.innerHTML = '<div class=\"item\"><div class=\"grid-stack-item-content\"></div></div>';\n      let el = doc.body.children[0] as HTMLElement;\n      grid.el.appendChild(el);\n      let w = grid.makeWidget('item');\n      expect(w.getAttribute('gs-x')).toBe(null);\n    });\n    it('passing id >', () => {\n      grid = GridStack.init();\n      let doc = document.implementation.createHTMLDocument();\n      doc.body.innerHTML = '<div id=\"item\"><div class=\"grid-stack-item-content\"></div></div>';\n      let el = doc.body.children[0] as HTMLElement;\n      grid.el.appendChild(el);\n      let w = grid.makeWidget('#item');\n      expect(w.getAttribute('gs-x')).toBe(null);\n    });\n    it('passing id no # >', () => {\n      grid = GridStack.init();\n      let doc = document.implementation.createHTMLDocument();\n      doc.body.innerHTML = '<div id=\"item\"><div class=\"grid-stack-item-content\"></div></div>';\n      let el = doc.body.children[0] as HTMLElement;\n      grid.el.appendChild(el);\n      let w = grid.makeWidget('item');\n      expect(w.getAttribute('gs-x')).toBe(null);\n    });\n    it('passing id as number >', () => {\n      grid = GridStack.init();\n      let doc = document.implementation.createHTMLDocument();\n      doc.body.innerHTML = '<div id=\"1\"><div class=\"grid-stack-item-content\"></div></div>';\n      let el = doc.body.children[0] as HTMLElement;\n      grid.el.appendChild(el);\n      let w = grid.makeWidget('1');\n      expect(w.getAttribute('gs-x')).toBe(null);\n    });\n  });\n\n  describe('method getFloat() >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should match true/false only >', () => {\n      grid = GridStack.init({float: true});\n      expect(grid.getFloat()).toBe(true);\n      (grid as any).float(0);\n      expect(grid.getFloat()).toBe(false);\n      grid.float(null);\n      expect(grid.getFloat()).toBe(false);\n      grid.float(undefined);\n      expect(grid.getFloat()).toBe(false);\n      grid.float(false);\n      expect(grid.getFloat()).toBe(false);\n    });\n  });\n\n  describe('grid.destroy >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.getElementById('gs-cont').remove();\n    });\n    it('should cleanup gridstack >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5\n      };\n      grid = GridStack.init(options);\n      let gridEl = grid.el;\n      grid.destroy();\n      expect(gridEl.parentElement).toBe(null);\n      expect(grid.el).toBe(undefined);\n      expect(grid.engine).toBe(undefined);\n    });\n    it('should cleanup gridstack but leave elements >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5\n      };\n      grid = GridStack.init(options);\n      let gridEl = grid.el;\n      grid.destroy(false);\n      expect(gridEl.parentElement).not.toBe(null);\n      expect(Utils.getElements('.grid-stack-item').length).toBe(2);\n      expect(grid.el).toBe(undefined);\n      expect(grid.engine).toBe(undefined);\n      grid.destroy(); // sanity check for call twice!\n    });\n  });\n\n  describe('grid.resize >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should resize widget >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5\n      };\n      grid = GridStack.init(options);\n      let items = Utils.getElements('.grid-stack-item');\n      grid.update(items[0], {w:5, h:5});\n      expect(parseInt(items[0].getAttribute('gs-w'))).toBe(5);\n      expect(parseInt(items[0].getAttribute('gs-h'))).toBe(5);\n    });\n  });\n\n  describe('grid.move >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should move widget >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5,\n        float: true\n      };\n      grid = GridStack.init(options);\n      let items = Utils.getElements('.grid-stack-item');\n      grid.update(items[0], {x:5, y:5});\n      expect(parseInt(items[0].getAttribute('gs-x'))).toBe(5);\n      expect(parseInt(items[0].getAttribute('gs-y'))).toBe(5);\n    });\n  });\n\n  describe('grid.update >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should move and resize widget >', () => {\n      grid = GridStack.init({float: true});\n      let el = Utils.getElements('.grid-stack-item')[1];\n      expect(parseInt(el.getAttribute('gs-w'))).toBe(4);\n      \n      grid.update(el, {x: 5, y: 4, h: 2});\n      expect(parseInt(el.getAttribute('gs-x'))).toBe(5);\n      expect(parseInt(el.getAttribute('gs-y'))).toBe(4);\n      expect(parseInt(el.getAttribute('gs-w'))).toBe(4);\n      expect(parseInt(el.getAttribute('gs-h'))).toBe(2);\n    });\n    it('should change noMove >', () => {\n      grid = GridStack.init({float: true});\n      let items = Utils.getElements('.grid-stack-item');\n      let el = items[1];\n      let dd = GridStack.getDD();\n      \n      grid.update(el, {noMove: true, noResize: false});\n      expect(el.getAttribute('gs-no-move')).toBe('true');\n      expect(el.getAttribute('gs-no-resize')).toBe(null); // false is no-op\n      expect(dd.isResizable(el)).toBe(true);\n      expect(dd.isDraggable(el)).toBe(false);\n      expect(dd.isResizable(items[0])).toBe(true);\n      expect(dd.isDraggable(items[0])).toBe(true);\n\n      expect(parseInt(el.getAttribute('gs-x'))).toBe(4);\n      expect(el.getAttribute('gs-y')).toBe(null);\n      expect(parseInt(el.getAttribute('gs-w'))).toBe(4);\n      expect(parseInt(el.getAttribute('gs-h'))).toBe(4);\n    });\n    it('should change content and id, and move >', () => {\n      grid = GridStack.init({float: true});\n      let el = findEl('gsItem2');\n      let sub = el.querySelector('.grid-stack-item-content');\n\n      grid.update(el, {id: 'newID', y: 1, content: 'new content'});\n      expect(el.gridstackNode.id).toBe('newID');\n      expect(el.getAttribute('gs-id')).toBe('newID');\n      expect(sub.innerHTML).toBe('new content');\n      expect(parseInt(el.getAttribute('gs-x'))).toBe(4);\n      expect(parseInt(el.getAttribute('gs-y'))).toBe(1);\n      expect(parseInt(el.getAttribute('gs-w'))).toBe(4);\n      expect(parseInt(el.getAttribute('gs-h'))).toBe(4);\n    });\n    it('should change max and constrain a wanted resize >', () => {\n      grid = GridStack.init({float: true});\n      let el = findEl('gsItem2');\n      expect(el.getAttribute('gs-max-w')).toBe(null);\n\n      grid.update(el, {maxW: 2, w: 5});\n      expect(parseInt(el.getAttribute('gs-x'))).toBe(4);\n      expect(el.getAttribute('gs-y')).toBe(null);\n      expect(parseInt(el.getAttribute('gs-w'))).toBe(2);\n      expect(parseInt(el.getAttribute('gs-h'))).toBe(4);\n      expect(el.gridstackNode.maxW).toBe(2);\n    });\n    it('should change max and constrain existing >', () => {\n      grid = GridStack.init({float: true});\n      let el = findEl('gsItem2');\n      expect(el.getAttribute('gs-max-w')).toBe(null);\n\n      grid.update(el, {maxW: 2});\n      expect(parseInt(el.getAttribute('gs-x'))).toBe(4);\n      expect(el.getAttribute('gs-y')).toBe(null);\n      expect(parseInt(el.getAttribute('gs-w'))).toBe(2);\n      expect(parseInt(el.getAttribute('gs-h'))).toBe(4);\n      expect(el.gridstackNode.maxW).toBe(2);\n    });\n    it('should change all max and move, no inf loop! >', () => {\n      grid = GridStack.init({float: true});\n      let items = Utils.getElements('.grid-stack-item');\n\n      items.forEach(item => {\n        expect(item.getAttribute('gs-max-w')).toBe(null);\n        expect(item.getAttribute('gs-max-h')).toBe(null);\n      });\n\n      grid.update('.grid-stack-item', {maxW: 2, maxH: 2});\n      expect(items[0].getAttribute('gs-x')).toBe(null);\n      expect(parseInt(items[1].getAttribute('gs-x'))).toBe(4);\n      items.forEach((item: GridItemHTMLElement) => {\n        expect(item.getAttribute('gs-y')).toBe(null);\n        expect(parseInt(item.getAttribute('gs-h'))).toBe(2);\n        expect(parseInt(item.getAttribute('gs-w'))).toBe(2);\n        expect(item.gridstackNode.maxW).toBe(2);\n        expect(item.gridstackNode.maxH).toBe(2);\n      });\n    });\n  });\n\n  describe('grid.margin >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should return margin >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 12\n      };\n      grid = GridStack.init(options);\n      expect(grid.getMargin()).toBe(12);\n    });\n    it('should return update margin >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5\n      };\n      grid = GridStack.init(options);\n      grid.margin('11rem');\n      expect(grid.getMargin()).toBe(11);\n    });\n    it('should change unit >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 10,\n      };\n      grid = GridStack.init(options);\n      expect(grid.getMargin()).toBe(10);\n      grid.margin('10rem');\n      expect(grid.getMargin()).toBe(10);\n    });\n    it('should not update css vars, with same value >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5\n      };\n      let grid: any = GridStack.init(options);\n      expect(grid.getMargin()).toBe(5);\n      vi.spyOn(grid, '_initMargin');\n      grid.margin('5px');\n      expect(grid._initMargin).not.toHaveBeenCalled();\n      expect(grid.getMargin()).toBe(5);\n    });\n    it('should set top/bot/left value directly >', () => {\n      let options = {\n        cellHeight: 80,\n        marginTop: 5,\n        marginBottom: 0,\n        marginLeft: 1,\n      };\n      let grid: any = GridStack.init(options);\n      expect(grid.getMargin()).toBe(undefined);\n      expect(grid.opts.marginTop).toBe(5);\n      expect(grid.opts.marginBottom).toBe(0);\n      expect(grid.opts.marginLeft).toBe(1);\n      expect(grid.opts.marginRight).toBe(10); // default value\n    });\n    it('should set all 4 sides, and overall margin >', () => {\n      let options = {\n        cellHeight: 80,\n        marginTop: 5,\n        marginBottom: 5,\n        marginLeft: 5,\n        marginRight: 5,\n      };\n      let grid: any = GridStack.init(options);\n      expect(grid.getMargin()).toBe(5);\n      expect(grid.opts.marginTop).toBe(5);\n      expect(grid.opts.marginBottom).toBe(5);\n      expect(grid.opts.marginLeft).toBe(5);\n      expect(grid.opts.marginRight).toBe(5);\n    });\n    it('init 2 values >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: '5px 10'\n      };\n      let grid: any = GridStack.init(options);\n      expect(grid.getMargin()).toBe(undefined);\n      expect(grid.opts.marginTop).toBe(5);\n      expect(grid.opts.marginBottom).toBe(5);\n      expect(grid.opts.marginLeft).toBe(10);\n      expect(grid.opts.marginRight).toBe(10);\n    });\n    it('init 4 values >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: '1 2 0em 3'\n      };\n      let grid = GridStack.init(options);\n      expect(grid.getMargin()).toBe(undefined);\n      expect(grid.opts.marginTop).toBe(1);\n      expect(grid.opts.marginRight).toBe(2);\n      expect(grid.opts.marginBottom).toBe(0);\n      expect(grid.opts.marginLeft).toBe(3);\n    });\n    it('set 2 values, should update css vars >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5\n      };\n      let grid = GridStack.init(options); \n      expect(grid.getMargin()).toBe(5);\n      grid.margin('1px 0');\n      expect(grid.getMargin()).toBe(undefined);\n      expect(grid.opts.marginTop).toBe(1);\n      expect(grid.opts.marginBottom).toBe(1);\n      expect(grid.opts.marginLeft).toBe(0);\n      expect(grid.opts.marginRight).toBe(0);\n    });\n  });\n\n  describe('grid.opts.rtl >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should add grid-stack-rtl class >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5,\n        rtl: true\n      };\n      grid = GridStack.init(options);\n      expect(grid.el.classList.contains('grid-stack-rtl')).toBe(true);\n    });\n    it('should not add grid-stack-rtl class >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5\n      };\n      grid = GridStack.init(options);\n      expect(grid.el.classList.contains('grid-stack-rtl')).toBe(false);\n    });\n  }); \n\n  describe('grid.enableMove', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should enable move for future also', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5,\n        disableDrag: true\n      };\n      grid = GridStack.init(options);\n      let items = Utils.getElements('.grid-stack-item');\n      items.forEach(el => expect(el.classList.contains('ui-draggable-disabled')).toBe(true));\n      expect(grid.opts.disableDrag).toBe(true);\n\n      grid.enableMove(true);\n      items.forEach(el => expect(el.classList.contains('ui-draggable-disabled')).toBe(false));\n      expect(grid.opts.disableDrag).not.toBe(true);\n    });\n    it('should disable move for existing only >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5\n      };\n      grid = GridStack.init(options);\n      let items = Utils.getElements('.grid-stack-item');\n      items.forEach(el => expect(el.classList.contains('ui-draggable-disabled')).toBe(false));\n      expect(grid.opts.disableDrag).toBeFalsy();\n\n      grid.enableMove(false);\n      items.forEach(el => expect(el.classList.contains('ui-draggable-disabled')).toBe(true));\n      expect(grid.opts.disableDrag).toBe(true);\n    });\n  });\n\n  describe('grid.enableResize >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should enable resize >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5,\n        disableResize: true\n      };\n      grid = GridStack.init(options);\n      expect(grid.opts.disableResize).toBe(true);\n      let items = Utils.getElements('.grid-stack-item');\n      let dd = GridStack.getDD();\n      expect(dd).not.toBe(null); // sanity test to verify type\n      items.forEach(el => {\n        expect(dd.isResizable(el)).toBe(false);\n        expect(dd.isDraggable(el)).toBe(true);\n      });\n      grid.enableResize(true);\n      expect(grid.opts.disableResize).not.toBe(true);\n      items.forEach(el => {\n        expect(dd.isResizable(el)).toBe(true);\n        expect(dd.isDraggable(el)).toBe(true);\n      });\n    });\n    it('should disable resize >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5\n      };\n      grid = GridStack.init(options);\n      expect(grid.opts.disableResize).toBeFalsy();\n      let items = Utils.getElements('.grid-stack-item');\n      let dd = GridStack.getDD();\n      items.forEach(el => expect(dd.isResizable(el)).toBe(true));\n      grid.enableResize(false);\n      expect(grid.opts.disableResize).toBe(true);\n      items.forEach(el => {\n        expect(dd.isResizable(el)).toBe(false);\n        expect(dd.isDraggable(el)).toBe(true);\n      });\n    });\n  });\n\n  describe('grid.enable >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should enable movable and resizable >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5\n      };\n      grid = GridStack.init(options);\n      let items = Utils.getElements('.grid-stack-item');\n      let dd = GridStack.getDD();\n      grid.enableResize(false);\n      grid.enableMove(false);\n      items.forEach(el => {\n        expect(el.classList.contains('ui-draggable-disabled')).toBe(true);\n        expect(dd.isResizable(el)).toBe(false);\n        expect(dd.isDraggable(el)).toBe(false);\n      });\n      grid.enable();\n      items.forEach(el => {\n        expect(el.classList.contains('ui-draggable-disabled')).toBe(false);\n        expect(dd.isResizable(el)).toBe(true);\n        expect(dd.isDraggable(el)).toBe(true);\n      });\n    });\n  });\n\n  describe('grid.enable >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should lock widgets >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5\n      };\n      grid = GridStack.init(options);\n      grid.update('.grid-stack-item', {locked: true});\n      Utils.getElements('.grid-stack-item').forEach(item => {\n        expect(item.getAttribute('gs-locked')).toBe('true');\n      })\n    });\n    it('should unlock widgets >', () => {\n      let options = {\n        cellHeight: 80,\n        margin: 5\n      };\n      grid = GridStack.init(options);\n      grid.update('.grid-stack-item', {locked: false});\n      Utils.getElements('.grid-stack-item').forEach(item => {\n        expect(item.getAttribute('gs-locked')).toBe(null);\n      })\n    });\n  });\n\n  describe('custom grid placement #1054 >', () => {\n    let HTML = \n    '<div style=\"w: 800px; h: 600px\" id=\"gs-cont\">' +\n    '  <div class=\"grid-stack\">' +\n    '    <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"0\" gs-w=\"12\" gs-h=\"9\">' +\n    '      <div class=\"grid-stack-item-content\"></div>' +\n    '    </div>' +\n    '    <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"9\" gs-w=\"12\" gs-h=\"5\">' +\n    '      <div class=\"grid-stack-item-content\"></div>' +\n    '    </div>' +\n    '    <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"14\" gs-w=\"7\" gs-h=\"6\">' +\n    '      <div class=\"grid-stack-item-content\"></div>' +\n    '    </div>' +\n    '    <div class=\"grid-stack-item\" gs-x=\"7\" gs-y=\"14\" gs-w=\"5\" gs-h=\"6\">' +\n    '      <div class=\"grid-stack-item-content\"></div>' +\n    '    </div>' +\n    '  </div>' +\n    '</div>';\n    let pos = [{x:0, y:0, w:12, h:9}, {x:0, y:9, w:12, h:5}, {x:0, y:14, w:7, h:6}, {x:7, y:14, w:5, h:6}];\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', HTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should have correct position >', () => {\n      let items = Utils.getElements('.grid-stack-item');\n      items.forEach((el, i) => {\n        expect(parseInt(el.getAttribute('gs-x'))).toBe(pos[i].x);\n        expect(parseInt(el.getAttribute('gs-y'))).toBe(pos[i].y);\n        expect(parseInt(el.getAttribute('gs-w'))).toBe(pos[i].w);\n        expect(parseInt(el.getAttribute('gs-h'))).toBe(pos[i].h);\n      });\n    });\n  });\n\n  describe('grid.compact >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should move all 3 items to top-left with no space >', () => {\n      grid = GridStack.init({float: true});\n\n      let el3 = grid.addWidget({x: 3, y: 5});\n      expect(parseInt(el3.getAttribute('gs-x'))).toBe(3);\n      expect(parseInt(el3.getAttribute('gs-y'))).toBe(5);\n\n      grid.compact();\n      expect(parseInt(el3.getAttribute('gs-x'))).toBe(8);\n      expect(el3.getAttribute('gs-y')).toBe(null);\n    });\n    it('not move locked item >', () => {\n      grid = GridStack.init({float: true});\n\n      let el3 = grid.addWidget({x: 3, y: 5, locked: true, noMove: true});\n      expect(parseInt(el3.getAttribute('gs-x'))).toBe(3);\n      expect(parseInt(el3.getAttribute('gs-y'))).toBe(5);\n\n      grid.compact();\n      expect(parseInt(el3.getAttribute('gs-x'))).toBe(3);\n      expect(parseInt(el3.getAttribute('gs-y'))).toBe(5);\n    });\n  });\n\n  describe('gridOption locked #1181 >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackEmptyHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('not move locked item, size down added one >', () => {\n      grid = GridStack.init();\n      let el1 = grid.addWidget({x: 0, y: 1, w: 12,  locked: true});\n      expect(el1.getAttribute('gs-x')).toBe(null);\n      expect(parseInt(el1.getAttribute('gs-y'))).toBe(1);\n\n      let el2 = grid.addWidget({x: 2, y: 0, h: 3});\n      expect(el1.getAttribute('gs-x')).toBe(null);\n      expect(parseInt(el1.getAttribute('gs-y'))).toBe(1);\n      expect(parseInt(el2.getAttribute('gs-x'))).toBe(2);\n      expect(parseInt(el2.getAttribute('gs-y'))).toBe(2);\n      expect(parseInt(el2.getAttribute('gs-h'))).toBe(3);\n    });\n\n  });\n\n  describe('nested grids >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackNestedHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('should both init, second with nested class >', () => {\n      grids = GridStack.initAll();\n      expect(grids.length).toBe(2);\n      expect(grids[0].el.classList.contains('grid-stack-nested')).toBe(false);\n      expect(grids[1].el.classList.contains('grid-stack-nested')).toBe(true);\n    });\n  });\n\n  describe('two grids >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridHTML);\n      document.body.insertAdjacentHTML('afterbegin', gridHTML);\n    });\n    afterEach(() => {\n      let els = document.body.querySelectorAll('.grid-stack');\n      expect(els.length).toBe(2);\n      els.forEach(g => g.remove());\n    });\n    it('should not remove incorrect child >', () => {\n      grids = GridStack.initAll();\n      expect(grids.length).toBe(2);\n      expect(grids[0].engine.nodes.length).toBe(2);\n      expect(grids[1].engine.nodes.length).toBe(2);\n      // should do nothing\n      grids[0].removeWidget( grids[1].engine.nodes[0].el );\n      expect(grids[0].engine.nodes.length).toBe(2);\n      expect(grids[0].el.children.length).toBe(2);\n      expect(grids[1].engine.nodes.length).toBe(2);\n      expect(grids[1].el.children.length).toBe(2);\n      // should empty with no errors\n      grids[1].removeAll();\n      expect(grids[0].engine.nodes.length).toBe(2);\n      expect(grids[0].el.children.length).toBe(2);\n      expect(grids[1].engine.nodes.length).toBe(0);\n      expect(grids[1].el.children.length).toBe(0);\n    });\n    it('should remove 1 child >', () => {\n      grids = GridStack.initAll();\n      grids[1].removeWidget( grids[1].engine.nodes[0].el );\n      expect(grids[0].engine.nodes.length).toBe(2);\n      expect(grids[0].el.children.length).toBe(2);\n      expect(grids[1].engine.nodes.length).toBe(1);\n      expect(grids[1].el.children.length).toBe(1);\n    });\n  });\n\n  describe('grid.on events >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('add 3 single events >', () => {\n      grid = GridStack.init();\n      let fcn = (event: Event) => {};\n      grid.on('added', fcn).on('enable', fcn).on('dragstart', fcn);\n      expect((grid as any)._gsEventHandler.enable).not.toBe(undefined);\n      grid.off('added').off('enable').off('dragstart');\n      expect((grid as any)._gsEventHandler.enable).toBe(undefined);\n    });\n    it('add 3 events >', () => {\n      let grid: any = GridStack.init(); // prevent TS check for string combine...\n      let fcn = (event: CustomEvent) => {};\n      grid.on('added enable dragstart', fcn);\n      expect((grid as any)._gsEventHandler.enable).not.toBe(undefined);\n      grid.off('added enable dragstart');\n      expect((grid as any)._gsEventHandler.enable).toBe(undefined);\n    });\n\n  });\n\n  describe('save & load >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('save layout >', () => {\n      grid = GridStack.init({maxRow: 10});\n      let layout = grid.save(false);\n      expect(layout).toEqual([{x:0, y:0, w:4, h:2, id:'gsItem1'}, {x:4, y:0, w:4, h:4, id:'gsItem2'}]);\n      layout = grid.save();\n      expect(layout).toEqual([{x:0, y:0, w:4, h:2, id:'gsItem1', content:'item 1 text'}, {x:4, y:0, w:4, h:4, id:'gsItem2', content:'item 2 text'}]);\n      layout = grid.save(true);\n      expect(layout).toEqual([{x:0, y:0, w:4, h:2, id:'gsItem1', content:'item 1 text'}, {x:4, y:0, w:4, h:4, id:'gsItem2', content:'item 2 text'}]);\n    });\n    it('save layout full >', () => {\n      grid = GridStack.init({maxRow: 10, _foo: 'bar'} as any); // using bogus 'internal' field (stripped)\n      let layout = grid.save(false, true);\n      expect(layout).toEqual({maxRow: 10, children: [{x:0, y:0, w:4, h:2, id:'gsItem1'}, {x:4, y:0, w:4, h:4, id:'gsItem2'}]});\n      layout = grid.save(true, true);\n      expect(layout).toEqual({maxRow: 10, children: [{x:0, y:0, w:4, h:2, id:'gsItem1', content:'item 1 text'}, {x:4, y:0, w:4, h:4, id:'gsItem2', content:'item 2 text'}]});\n    });\n    it('load move 1 item, delete others >', () => {\n      grid = GridStack.init();\n      grid.load([{x:2, h:1, id:'gsItem2'}]);\n      let layout = grid.save(false);\n      expect(layout).toEqual([{x:0, y:0, id:'gsItem2'}]);\n    });\n    it('load add new, delete others >', () => {\n      grid = GridStack.init();\n      grid.load([{w:2, y:0, h:1, id:'gsItem3'}], true);\n      let layout = grid.save(false);\n      expect(layout).toEqual([{x:0, y:0, w:2, id:'gsItem3'}]);\n    });\n    it('load 1 item only, no remove >', () => {\n      grid = GridStack.init();\n      grid.load([{h:3, id:'gsItem1'}], false);\n      let layout = grid.save(false);\n      expect(layout).toEqual([{x:0, y:0, h:3, id:'gsItem1'}, {x:4, y:0, w:4, h:4, id:'gsItem2'}]);\n    });\n    it('load 1 item only with callback >', () => {\n      grid = GridStack.init();\n      grid.load([{h:3, id:'gsItem1'}], () => null);\n      let layout = grid.save(false);\n      expect(layout).toEqual([{x:0, y:0, h:3, id:'gsItem1'}]);\n    });\n  });\n\n  describe('load >', () => {\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('after init #1693 >', () => {\n      grid = GridStack.init();\n      grid.load([{id:'gsItem1',x:0,y:0,w:5,h:1},{id:'gsItem2',x:6,y:0,w:2,h:2}]);\n\n      let el1 = document.getElementById('item1')\n      expect(el1.getAttribute('gs-x')).toBe(null);\n      expect(el1.getAttribute('gs-y')).toBe(null);\n      expect(parseInt(el1.getAttribute('gs-w'))).toBe(5);\n      expect(el1.getAttribute('gs-h')).toBe(null);\n\n      let el2 = document.getElementById('item2')\n      expect(parseInt(el2.getAttribute('gs-x'))).toBe(6);\n      expect(el2.getAttribute('gs-y')).toBe(null);\n      expect(parseInt(el2.getAttribute('gs-w'))).toBe(2);\n      expect(parseInt(el2.getAttribute('gs-h'))).toBe(2);\n    });\n    it('after init replace nodes >', () => {\n      grid = GridStack.init();\n      expect(document.getElementById('item1')).not.toBe(null);\n      expect(document.getElementById('item2')).not.toBe(null);\n\n      // this will replace with 2 new nodes\n      grid.load([{id:'new1',x:0,y:0,w:5,h:1},{id:'new2',x:6,y:0,w:2,h:2}]);\n      expect(grid.engine.nodes.length).toBe(2);\n\n      expect(document.getElementById('item1')).toBe(null);\n      let el1 = grid.engine.nodes.find(n => n.id === 'new1').el;\n      expect(el1.getAttribute('gs-x')).toBe(null);\n      expect(el1.getAttribute('gs-y')).toBe(null);\n      expect(parseInt(el1.getAttribute('gs-w'))).toBe(5);\n      expect(el1.getAttribute('gs-h')).toBe(null);\n\n      expect(document.getElementById('item2')).toBe(null);\n      let el2 = grid.engine.nodes.find(n => n.id === 'new2').el;\n      expect(parseInt(el2.getAttribute('gs-x'))).toBe(6);\n      expect(el2.getAttribute('gs-y')).toBe(null);\n      expect(parseInt(el2.getAttribute('gs-w'))).toBe(2);\n      expect(parseInt(el2.getAttribute('gs-h'))).toBe(2);\n    });\n  });\n\n  describe('load empty >', () => {\n    let items: GridStackWidget[];\n    let grid: GridStack;\n    const test = () => {\n      items.forEach(item => {\n        const n = grid.engine.nodes.find(n => n.id === item.id);\n        if (item.y) expect(parseInt(n.el.getAttribute('gs-y'))).toBe(item.y!);\n        else expect(n.el.getAttribute('gs-y')).toBe(null);\n      });\n    }\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackEmptyHTML);\n      items = [\n        {id: '0', x: 0, y: 0},\n        {id: '1', x: 0, y: 1},\n        {id: '2', x: 0, y: 2},\n        {id: '3', x: 0, y: 3},\n      ];\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('update collision >', () => {\n      grid = GridStack.init({children: items});\n      const n = grid.engine.nodes[0];\n      test();\n\n      grid.update(n.el!, {h:5});\n      items[1].y = 5; items[2].y = 6; items[3].y = 7;\n      test();\n\n      grid.update(n.el!, {h:1});\n      items[1].y = 1; items[2].y = 2; items[3].y = 3;\n      test();\n    });\n    it('load collision 2208 >', () => {\n      grid = GridStack.init({children: items});\n      test();\n\n      items[0].h = 5;\n      grid.load(items);\n      items[1].y = 5; items[2].y = 6; items[3].y = 7;\n      test();\n\n      items[0].h = 1;\n      grid.load(items);\n      items[1].y = 1; items[2].y = 2; items[3].y = 3;\n      test();\n    });\n    it('load full collision 2208 >', () => {\n      grid = GridStack.init({children: items});\n      test();\n\n      items[0].h = 5;\n      grid.load(grid.engine.nodes.map((n, index) => {\n        if (index === 0) return {...n, h: 5}\n        return n;\n      }));\n      items[1].y = 5; items[2].y = 6; items[3].y = 7;\n      test();\n\n      items[0].h = 1;\n      grid.load(grid.engine.nodes.map((n, index) => {\n        if (index === 0) return {...n, h: 1}\n        return n;\n      }));\n      items[1].y = 1; items[2].y = 2; items[3].y = 3;\n      test();\n    });\n  });\n\n  // Note: Stylesheet tests moved to E2E tests\n  // where real browser CSS engines can provide accurate getComputedStyle() values\n  // describe('stylesheet', () => {});\n\n  \n  describe('updateOptions()', () => {\n    let grid: GridStack;\n    beforeEach(() => {\n      document.body.insertAdjacentHTML('afterbegin', gridstackHTML);\n      grid = GridStack.init({ cellHeight: 30 });\n    });\n    afterEach(() => {\n      document.body.removeChild(document.getElementById('gs-cont'));\n    });\n    it('update all values supported', () => {\n      grid.updateOptions({\n        cellHeight: '40px',\n        margin: 8,\n        column: 11,\n        float: true, \n        row: 10,\n      });\n      expect(grid.getCellHeight(true)).toBe(40);\n      expect(grid.getMargin()).toBe(8);\n      expect(grid.opts.marginTop).toBe(8);\n      expect(grid.getColumn()).toBe(11);\n      expect(grid.getFloat()).toBe(true);\n      expect(grid.opts.row).toBe(10);\n      expect(grid.opts.minRow).toBe(10);\n      expect(grid.opts.maxRow).toBe(10);\n    });\n  });\n\n});\n"
  },
  {
    "path": "spec/integration/gridstack-integration.spec.ts",
    "content": "import { GridStack } from '../../src/gridstack';\n\n// Integration tests for GridStack HTML scenarios\n// These test actual GridStack behavior with DOM manipulation\n\ndescribe('GridStack Integration Tests', () => {\n  beforeEach(() => {\n    // // Clean up DOM before each test\n    // document.body.innerHTML = '';\n    // // Add basic CSS for GridStack to function properly\n    // const style = document.createElement('style');\n    // style.textContent = `\n    //   .grid-stack { position: relative; }\n    //   .grid-stack-item { position: absolute; }\n    //   .grid-stack-item-content { width: 100%; height: 100%; }\n    // `;\n    // document.head.appendChild(style);\n  });\n\n  afterEach(() => {\n    // // Clean up any GridStack instances\n    // GridStack.removeAll;\n    // // Clean up added styles\n    // const styles = document.head.querySelectorAll('style');\n    // styles.forEach(style => style.remove());\n  });\n\n  describe('Auto-positioning with no x,y coordinates', () => {\n    it('should position items in order 5,1,2,4,3 based on their constraints', () => {\n      // Create the HTML structure from the test file\n      document.body.innerHTML = `\n        <div class=\"grid-stack\">\n          <div class=\"grid-stack-item upper\" gs-w=\"2\" gs-h=\"2\" gs-id=\"1\">\n            <div class=\"grid-stack-item-content\">item 1</div>\n          </div>\n          <div class=\"grid-stack-item\" gs-w=\"3\" gs-h=\"2\" gs-id=\"2\">\n            <div class=\"grid-stack-item-content\">item 2</div>\n          </div>\n          <div class=\"grid-stack-item\" gs-w=\"9\" gs-h=\"1\" gs-id=\"3\">\n            <div class=\"grid-stack-item-content\">item 3 too big to fit, so next row</div>\n          </div>\n          <div class=\"grid-stack-item\" gs-w=\"3\" gs-h=\"1\" gs-id=\"4\">\n            <div class=\"grid-stack-item-content\">item 4</div>\n          </div>\n          <div class=\"grid-stack-item\" gs-x=\"1\" gs-y=\"1\" gs-w=\"1\" gs-h=\"1\" gs-id=\"5\">\n            <div class=\"grid-stack-item-content\">item 5 first</div>\n          </div>\n        </div>\n      `;\n\n      // Initialize GridStack with same options as test\n      const options = {\n        cellHeight: 80,\n        margin: 5,\n        float: true\n      };\n      const grid = GridStack.init(options);\n\n      // Get all nodes and their positions\n      const nodes = grid.engine.nodes;\n      expect(nodes).toHaveLength(5);\n\n      // Item 5 should be positioned (has explicit x=1, y=1 in HTML)\n      const item5 = nodes.find(n => n.id === '5');\n      expect(item5).toBeDefined();\n      expect(item5!.w).toBe(1);\n      expect(item5!.h).toBe(1);\n\n      // Item 1 should be positioned next (2x2)\n      const item1 = nodes.find(n => n.id === '1');\n      expect(item1).toBeDefined();\n      expect(item1!.w).toBe(2);\n      expect(item1!.h).toBe(2);\n\n      // Item 2 should be positioned (3x2)  \n      const item2 = nodes.find(n => n.id === '2');\n      expect(item2).toBeDefined();\n      expect(item2!.w).toBe(3);\n      expect(item2!.h).toBe(2);\n\n      // Item 4 should be positioned (3x1)\n      const item4 = nodes.find(n => n.id === '4');\n      expect(item4).toBeDefined();\n      expect(item4!.w).toBe(3);\n      expect(item4!.h).toBe(1);\n\n      // Item 3 should be on next row (too big to fit - 9x1)\n      const item3 = nodes.find(n => n.id === '3');\n      expect(item3).toBeDefined();\n      expect(item3!.w).toBe(9);\n      expect(item3!.h).toBe(1);\n      \n      // Verify all items are positioned (have valid coordinates)\n      nodes.forEach(node => {\n        expect(node.x).toBeGreaterThanOrEqual(0);\n        expect(node.y).toBeGreaterThanOrEqual(0);\n        expect(node.w).toBeGreaterThan(0);\n        expect(node.h).toBeGreaterThan(0);\n      });\n    });\n  });\n\n  describe('Grid initialization and basic functionality', () => {\n    it('should initialize GridStack with items and maintain data integrity', () => {\n      document.body.innerHTML = `\n        <div class=\"grid-stack\">\n          <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"0\" gs-w=\"4\" gs-h=\"2\" gs-id=\"item1\">\n            <div class=\"grid-stack-item-content\">Item 1</div>\n          </div>\n          <div class=\"grid-stack-item\" gs-x=\"4\" gs-y=\"0\" gs-w=\"4\" gs-h=\"4\" gs-id=\"item2\">\n            <div class=\"grid-stack-item-content\">Item 2</div>\n          </div>\n        </div>\n      `;\n\n      const grid = GridStack.init();\n      \n      expect(grid).toBeDefined();\n      expect(grid.engine.nodes).toHaveLength(2);\n      \n      const item1 = grid.engine.nodes.find(n => n.id === 'item1');\n      const item2 = grid.engine.nodes.find(n => n.id === 'item2');\n      \n      expect(item1).toEqual(expect.objectContaining({\n        x: 0, y: 0, w: 4, h: 2, id: 'item1'\n      }));\n      \n      expect(item2).toEqual(expect.objectContaining({\n        x: 4, y: 0, w: 4, h: 4, id: 'item2'\n      }));\n    });\n\n    it('should handle empty grid initialization', () => {\n      document.body.innerHTML = '<div class=\"grid-stack\"></div>';\n      \n      const grid = GridStack.init();\n      \n      expect(grid).toBeDefined();\n      expect(grid.engine.nodes).toHaveLength(0);\n    });\n\n    it('should add widgets programmatically', () => {\n      document.body.innerHTML = '<div class=\"grid-stack\"></div>';\n      \n      const grid = GridStack.init();\n      \n      const addedEl = grid.addWidget({\n        x: 0, y: 0, w: 2, h: 2, id: 'new-widget'\n      });\n      \n      expect(addedEl).toBeDefined();\n      expect(grid.engine.nodes).toHaveLength(1);\n      \n      // Check that the widget was added with valid properties\n      const node = grid.engine.nodes[0];\n      expect(node.x).toBe(0);\n      expect(node.y).toBe(0);\n      // Note: w and h might default to 1x1 if not explicitly set in the HTML attributes\n    });\n  });\n\n  describe('Layout and positioning validation', () => {\n    it('should respect minRow constraints', () => {\n      document.body.innerHTML = '<div class=\"grid-stack\"></div>';\n      \n      const grid = GridStack.init({ minRow: 3 });\n      \n      // Even with no items, grid should maintain minimum rows\n      expect(grid.getRow()).toBeGreaterThanOrEqual(3);\n    });\n\n    it('should handle widget collision detection', () => {\n      document.body.innerHTML = `\n        <div class=\"grid-stack\">\n          <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"0\" gs-w=\"2\" gs-h=\"2\" gs-id=\"item1\">\n            <div class=\"grid-stack-item-content\">Item 1</div>\n          </div>\n        </div>\n      `;\n\n      const grid = GridStack.init();\n      \n      // Try to add overlapping widget\n      const widgetEl = grid.addWidget({\n        x: 1, y: 1, w: 2, h: 2, id: 'overlap'\n      });\n      \n      expect(widgetEl).toBeDefined();\n      expect(grid.engine.nodes).toHaveLength(2);\n      \n      // Verify that items don't actually overlap (GridStack should handle collision)\n      // Just verify we have 2 nodes without overlap testing since the API changed\n      const nodes = grid.engine.nodes;\n      expect(nodes).toHaveLength(2);\n      \n      // All nodes should have valid positions\n      nodes.forEach(node => {\n        expect(node.x).toBeGreaterThanOrEqual(0);\n        expect(node.y).toBeGreaterThanOrEqual(0);\n        expect(node.w).toBeGreaterThan(0);\n        expect(node.h).toBeGreaterThan(0);\n      });\n    });\n  });\n});\n"
  },
  {
    "path": "spec/regression-spec.ts",
    "content": "import { GridItemHTMLElement, GridStack, GridStackWidget } from '../src/gridstack';\r\n\r\ndescribe('regression >', () => {\r\n  'use strict';\r\n\r\n  let grid: GridStack;\r\n  let findEl = function(id: string): GridItemHTMLElement {\r\n    return grid.engine.nodes.find(n => n.id === id)!.el!;\r\n  };\r\n  let findSubEl = function(id: string, index = 0): GridItemHTMLElement {\r\n    return grid.engine.nodes[index].subGrid?.engine.nodes.find(n => n.id === id)!.el!;\r\n  };\r\n\r\n\r\n  // empty grid\r\n  let gridstackEmptyHTML =\r\n  '<div style=\"width: 800px; height: 600px\" id=\"gs-cont\">' +\r\n  '  <div class=\"grid-stack\"></div>' +\r\n  '</div>';\r\n\r\n  describe('2492 load() twice >', () => {\r\n    beforeEach(() => {\r\n      document.body.insertAdjacentHTML('afterbegin', gridstackEmptyHTML);\r\n    });\r\n    afterEach(() => {\r\n      document.body.removeChild(document.getElementById('gs-cont'));\r\n    });\r\n    it('', () => {\r\n      let items: GridStackWidget[] = [\r\n        {x: 0, y: 0, w:2, content: '0 wide'},\r\n        {x: 1, y: 0, content: '1 over'},\r\n        {x: 2, y: 1, content: '2 float'},\r\n      ];\r\n      let count = 0;\r\n      items.forEach(n => n.id = String(count++));\r\n      grid = GridStack.init({cellHeight: 70, margin: 5}).load(items);\r\n\r\n      let el0 = findEl('0');\r\n      let el1 = findEl('1');\r\n      let el2 = findEl('2');\r\n\r\n      expect(el0.getAttribute('gs-x')).toBe(null);\r\n      expect(el0.getAttribute('gs-y')).toBe(null);\r\n      expect(el0.children[0].innerHTML).toBe(items[0].content!);\r\n      expect(parseInt(el1.getAttribute('gs-x'))).toBe(1);\r\n      expect(parseInt(el1.getAttribute('gs-y'))).toBe(1);\r\n      expect(parseInt(el2.getAttribute('gs-x'))).toBe(2);\r\n      expect(el2.getAttribute('gs-y')).toBe(null);\r\n\r\n      // loading with changed content should be same positions\r\n      items.forEach(n => n.content += '*')\r\n      grid.load(items);\r\n      expect(el0.getAttribute('gs-x')).toBe(null);\r\n      expect(el0.getAttribute('gs-y')).toBe(null);\r\n      expect(el0.children[0].innerHTML).toBe(items[0].content!);\r\n      expect(parseInt(el1.getAttribute('gs-x'))).toBe(1);\r\n      expect(parseInt(el1.getAttribute('gs-y'))).toBe(1);\r\n      expect(parseInt(el2.getAttribute('gs-x'))).toBe(2);\r\n      expect(el2.getAttribute('gs-y')).toBe(null);\r\n    });\r\n  });\r\n\r\n  describe('2865 nested grid resize >', () => {\r\n    beforeEach(() => {\r\n      document.body.insertAdjacentHTML('afterbegin', gridstackEmptyHTML);\r\n    });\r\n    afterEach(() => {\r\n      document.body.removeChild(document.getElementById('gs-cont'));\r\n    });\r\n    it('', () => {\r\n      let children: GridStackWidget[] = [{},{},{}];\r\n      let items: GridStackWidget[] = [\r\n        {x: 0, y: 0, w:3, h:5, sizeToContent: true, subGridOpts: {children, column: 'auto'}}\r\n      ];\r\n      let count = 0;\r\n      [...items, ...children].forEach(n => n.id = String(count++));\r\n      grid = GridStack.init({cellHeight: 70, margin: 5, children: items});\r\n\r\n      let nested = findEl('0');\r\n      let el1 = findSubEl('1');\r\n      let el2 = findSubEl('2');\r\n      let el3 = findSubEl('3');\r\n      expect(nested.getAttribute('gs-x')).toBe(null);\r\n      expect(nested.getAttribute('gs-y')).toBe(null);\r\n      expect(parseInt(nested.getAttribute('gs-w'))).toBe(3);\r\n      // TODO: sizeToContent doesn't seem to be called in headless mode ??? works in browser.\r\n      // expect(nested.getAttribute('gs-h')).toBe(null); // sizeToContent 5 -> 1 which is null\r\n      expect(el1.getAttribute('gs-x')).toBe(null);\r\n      expect(el1.getAttribute('gs-y')).toBe(null);\r\n      expect(parseInt(el2.getAttribute('gs-x'))).toBe(1);\r\n      expect(el2.getAttribute('gs-y')).toBe(null);\r\n      expect(parseInt(el3.getAttribute('gs-x'))).toBe(2);\r\n      expect(el3.getAttribute('gs-y')).toBe(null);\r\n\r\n      // now resize the nested grid to 2 -> should reflow el3\r\n      grid.update(nested, {w:2});\r\n      expect(nested.getAttribute('gs-x')).toBe(null);\r\n      expect(nested.getAttribute('gs-y')).toBe(null);\r\n      expect(parseInt(nested.getAttribute('gs-w'))).toBe(2);\r\n      // TODO: sizeToContent doesn't seem to be called in headless mode ??? works in browser.\r\n      // expect(parseInt(nested.getAttribute('gs-h'))).toBe(2);\r\n      expect(el1.getAttribute('gs-x')).toBe(null);\r\n      expect(el1.getAttribute('gs-y')).toBe(null);\r\n      expect(parseInt(el2.getAttribute('gs-x'))).toBe(1);\r\n      expect(el2.getAttribute('gs-y')).toBe(null);\r\n      // 3rd item pushed to next row\r\n      expect(el3.getAttribute('gs-x')).toBe(null);\r\n      expect(parseInt(el3.getAttribute('gs-y'))).toBe(1);\r\n    });\r\n  });\r\n});\r\n"
  },
  {
    "path": "spec/test.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\">\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Grid Spec test</title>\n  <link rel=\"stylesheet\" href=\"../demo/demo.css\"/>\n  <script src=\"../dist/gridstack-all.js\"></script>\n</head>\n<body>\n  <h1>Grid Spec test</h1>\n  <a class=\"btn btn-primary\" onClick=\"step1()\" href=\"#\">step1</a>\n  <a class=\"btn btn-primary\" onClick=\"step2()\" href=\"#\">step2</a>\n  <div class=\"grid-stack\">\n    <!-- <div class=\"grid-stack-item\" gs-x=\"0\" gs-y=\"0\" gs-w=\"4\" gs-h=\"2\" gs-id=\"gsItem1\" id=\"item1\">\n      <div class=\"grid-stack-item-content\">item 1 text</div>\n    </div>\n    <div class=\"grid-stack-item\" gs-x=\"4\" gs-y=\"0\" gs-w=\"4\" gs-h=\"4\" gs-id=\"gsItem2\" id=\"item2\">\n      <div class=\"grid-stack-item-content\">item 2 text</div>\n    </div> -->\n  </div>\n  <script type=\"text/javascript\">\n    // test for spec file debugging\n    let margin = 5;\n    let cellHeight = 70;\n    let children = [{},{},{}];\n      let items = [\n        {x: 0, y: 0, w:3, h:3, sizeToContent: true, \n          subGridOpts: {children, column: 'auto', margin, cellHeight}}\n      ];\n      let count = 0;\n      [...items, ...children].forEach(n => { n.id = String(count++); if (count>1) n.content=n.id});\n      grid = GridStack.init({cellHeight: cellHeight+20, margin, children: items});\n\n    step1 = function() {\n      grid.update(grid.engine.nodes[0].el, {w:2});\n    }\n    step2 = function() {\n    }\n  </script>\n</body>\n</html>\n"
  },
  {
    "path": "spec/utils-spec.ts",
    "content": "import { Utils } from '../src/utils';\n\ndescribe('gridstack utils', () => {\n  describe('setup of utils', () => {\n    it('should set gridstack Utils.', () => {\n      let utils = Utils;\n      expect(utils).not.toBeNull();\n      expect(typeof utils).toBe('function');\n    });\n  });\n\n  describe('test toBool', () => {\n    it('should return booleans.', () => {\n      expect(Utils.toBool(true)).toEqual(true);\n      expect(Utils.toBool(false)).toEqual(false);\n    });\n    it('should work with integer.', () => {\n      expect(Utils.toBool(1)).toEqual(true);\n      expect(Utils.toBool(0)).toEqual(false);\n    });\n    it('should work with Strings.', () => {\n      expect(Utils.toBool('')).toEqual(false);\n      expect(Utils.toBool('0')).toEqual(false);\n      expect(Utils.toBool('no')).toEqual(false);\n      expect(Utils.toBool('false')).toEqual(false);\n      expect(Utils.toBool('yes')).toEqual(true);\n      expect(Utils.toBool('yadda')).toEqual(true);\n    });\n  });\n\n  describe('test isIntercepted', () => {\n    let src = {x: 3, y: 2, w: 3, h: 2};\n\n    it('should intercept.', () => {\n      expect(Utils.isIntercepted(src, {x: 0, y: 0, w: 4, h: 3})).toEqual(true);\n      expect(Utils.isIntercepted(src, {x: 0, y: 0, w: 40, h: 30})).toEqual(true);\n      expect(Utils.isIntercepted(src, {x: 3, y: 2, w: 3, h: 2})).toEqual(true);\n      expect(Utils.isIntercepted(src, {x: 5, y: 3, w: 3, h: 2})).toEqual(true);\n    });\n    it('shouldn\\'t intercept.', () => {\n      expect(Utils.isIntercepted(src, {x: 0, y: 0, w: 3, h: 2})).toEqual(false);\n      expect(Utils.isIntercepted(src, {x: 0, y: 0, w: 13, h: 2})).toEqual(false);\n      expect(Utils.isIntercepted(src, {x: 1, y: 4, w: 13, h: 2})).toEqual(false);\n      expect(Utils.isIntercepted(src, {x: 0, y: 3, w: 3, h: 2})).toEqual(false);\n      expect(Utils.isIntercepted(src, {x: 6, y: 3, w: 3, h: 2})).toEqual(false);\n    });\n  });\n\n  describe('test parseHeight', () => {\n\n    it('should parse height value', () => {\n      expect(Utils.parseHeight(12)).toEqual(expect.objectContaining({h: 12, unit: 'px'}));\n      expect(Utils.parseHeight('12px')).toEqual(expect.objectContaining({h: 12, unit: 'px'}));\n      expect(Utils.parseHeight('12.3px')).toEqual(expect.objectContaining({h: 12.3, unit: 'px'}));\n      expect(Utils.parseHeight('12.3em')).toEqual(expect.objectContaining({h: 12.3, unit: 'em'}));\n      expect(Utils.parseHeight('12.3rem')).toEqual(expect.objectContaining({h: 12.3, unit: 'rem'}));\n      expect(Utils.parseHeight('12.3vh')).toEqual(expect.objectContaining({h: 12.3, unit: 'vh'}));\n      expect(Utils.parseHeight('12.3vw')).toEqual(expect.objectContaining({h: 12.3, unit: 'vw'}));\n      expect(Utils.parseHeight('12.3%')).toEqual(expect.objectContaining({h: 12.3, unit: '%'}));\n      expect(Utils.parseHeight('12.5cm')).toEqual(expect.objectContaining({h: 12.5, unit: 'cm'}));\n      expect(Utils.parseHeight('12.5mm')).toEqual(expect.objectContaining({h: 12.5, unit: 'mm'}));\n      expect(Utils.parseHeight('12.5')).toEqual(expect.objectContaining({h: 12.5, unit: 'px'}));\n      expect(() => { Utils.parseHeight('12.5 df'); }).toThrow('Invalid height val = 12.5 df');\n    });\n\n    it('should parse negative height value', () => {\n      expect(Utils.parseHeight(-12)).toEqual(expect.objectContaining({h: -12, unit: 'px'}));\n      expect(Utils.parseHeight('-12px')).toEqual(expect.objectContaining({h: -12, unit: 'px'}));\n      expect(Utils.parseHeight('-12.3px')).toEqual(expect.objectContaining({h: -12.3, unit: 'px'}));\n      expect(Utils.parseHeight('-12.3em')).toEqual(expect.objectContaining({h: -12.3, unit: 'em'}));\n      expect(Utils.parseHeight('-12.3rem')).toEqual(expect.objectContaining({h: -12.3, unit: 'rem'}));\n      expect(Utils.parseHeight('-12.3vh')).toEqual(expect.objectContaining({h: -12.3, unit: 'vh'}));\n      expect(Utils.parseHeight('-12.3vw')).toEqual(expect.objectContaining({h: -12.3, unit: 'vw'}));\n      expect(Utils.parseHeight('-12.3%')).toEqual(expect.objectContaining({h: -12.3, unit: '%'}));\n      expect(Utils.parseHeight('-12.3cm')).toEqual(expect.objectContaining({h: -12.3, unit: 'cm'}));\n      expect(Utils.parseHeight('-12.3mm')).toEqual(expect.objectContaining({h: -12.3, unit: 'mm'}));\n      expect(Utils.parseHeight('-12.5')).toEqual(expect.objectContaining({h: -12.5, unit: 'px'}));\n      expect(() => { Utils.parseHeight('-12.5 df'); }).toThrow('Invalid height val = -12.5 df');\n    });\n  });\n\n  describe('test defaults', () => {\n    it('should assign missing field or undefined', () => {\n      let src: any = {};\n      expect(src).toEqual({});\n      expect(Utils.defaults(src, {x: 1, y: 2})).toEqual({x: 1, y: 2});\n      expect(Utils.defaults(src, {x: 10})).toEqual({x: 1, y: 2});\n      src.w = undefined;\n      expect(src).toEqual({x: 1, y: 2, w: undefined});\n      expect(Utils.defaults(src, {x: 10, w: 3})).toEqual({x: 1, y: 2, w: 3});\n      expect(Utils.defaults(src, {h: undefined})).toEqual({x: 1, y: 2, w: 3, h: undefined});\n      src = {x: 1, y: 2, sub: {foo: 1, two: 2}};\n      expect(src).toEqual({x: 1, y: 2, sub: {foo: 1, two: 2}});\n      expect(Utils.defaults(src, {x: 10, w: 3})).toEqual({x: 1, y: 2, w: 3, sub: {foo: 1, two: 2}});\n      expect(Utils.defaults(src, {sub: {three: 3}})).toEqual({x: 1, y: 2, w: 3, sub: {foo: 1, two: 2, three: 3}});\n    });\n  });\n\n  describe('removePositioningStyles', () => {\n    it('should remove styles', () => {\n      let doc = document.implementation.createHTMLDocument();\n      doc.body.innerHTML = '<div style=\"position: absolute; left: 1; top: 2; w: 3; h: 4\"></div>';\n      let el = doc.body.children[0] as HTMLElement;\n      expect(el.style.position).toEqual('absolute');\n      // expect(el.style.left).toEqual('1'); // not working!\n\n      Utils.removePositioningStyles(el);\n      expect(el.style.position).toEqual('');\n\n      // bogus test\n      expect(Utils.getScrollElement(el)).not.toBe(null);\n      // bogus test\n      Utils.updateScrollPosition(el, {top: 20}, 10);\n    });\n  });\n\n  describe('clone', () => {\n    const a: any = {first: 1, second: 'text'};\n    const b: any = {first: 1, second: {third: 3}};\n    const c: any = {first: 1, second: [1, 2, 3], third: { fourth: {fifth: 5}}};\n    it('Should have the same values', () => {\n      const z = Utils.clone(a);\n      expect(z).toEqual({first: 1, second: 'text'});\n    });\n    it('Should have 2 in first key, and original unchanged', () => {\n      const z = Utils.clone(a);\n      z.first = 2;\n      expect(a).toEqual({first: 1, second: 'text'});\n      expect(z).toEqual({first: 2, second: 'text'});\n    });\n    it('Should have new string in second key, and original unchanged', () => {\n      const z = Utils.clone(a);\n      z.second = 2;\n      expect(a).toEqual({first: 1, second: 'text'});\n      expect(z).toEqual({first: 1, second: 2});\n    });\n    it('new string in both cases - use cloneDeep instead', () => {\n      const z = Utils.clone(b);\n      z.second.third = 'share';\n      expect(b).toEqual({first: 1, second: {third: 'share'}});\n      expect(z).toEqual({first: 1, second: {third: 'share'}});\n    });\n    it('Array Should match', () => {\n      const z = Utils.clone(c);\n      expect(c).toEqual({first: 1, second: [1, 2, 3], third: { fourth: {fifth: 5}}});\n      expect(z).toEqual({first: 1, second: [1, 2, 3], third: { fourth: {fifth: 5}}});\n    });\n    it('Array[0] changed in both cases - use cloneDeep instead', () => {\n      const z = Utils.clone(c);\n      z.second[0] = 0;\n      expect(c).toEqual({first: 1, second: [0, 2, 3], third: { fourth: {fifth: 5}}});\n      expect(z).toEqual({first: 1, second: [0, 2, 3], third: { fourth: {fifth: 5}}});\n    });\n    it('fifth changed in both cases - use cloneDeep instead', () => {\n      const z = Utils.clone(c);\n      z.third.fourth.fifth = 'share';\n      expect(c).toEqual({first: 1, second: [0, 2, 3], third: { fourth: {fifth: 'share'}}});\n      expect(z).toEqual({first: 1, second: [0, 2, 3], third: { fourth: {fifth: 'share'}}});\n    });\n  });\n  describe('cloneDeep', () => {\n    // reset our test cases\n    const a: any = {first: 1, second: 'text'};\n    const b: any = {first: 1, second: {third: 3}};\n    const c: any = {first: 1, second: [1, 2, 3], third: { fourth: {fifth: 5}}};\n    const d: any = {first: [1, [2, 3], ['four', 'five', 'six']]};\n    const e: any = {first: 1, __skip: {second: 2}};\n    const f: any = {first: 1, _dontskip: {second: 2}};\n  \n    it('Should have the same values', () => {\n      const z = Utils.cloneDeep(a);\n      expect(z).toEqual({first: 1, second: 'text'});\n    });\n    it('Should have 2 in first key, and original unchanged', () => {\n      const z = Utils.cloneDeep(a);\n      z.first = 2;\n      expect(a).toEqual({first: 1, second: 'text'});\n      expect(z).toEqual({first: 2, second: 'text'});\n    });\n    it('Should have new string in second key, and original unchanged', () => {\n      const z = Utils.cloneDeep(a);\n      z.second = 2;\n      expect(a).toEqual({first: 1, second: 'text'});\n      expect(z).toEqual({first: 1, second: 2});\n    });\n    it('Should have new string nested object, and original unchanged', () => {\n      const z = Utils.cloneDeep(b);\n      z.second.third = 'diff';\n      expect(b).toEqual({first: 1, second: {third: 3}});\n      expect(z).toEqual({first: 1, second: {third: 'diff'}});\n    });\n    it('Array Should match', () => {\n      const z = Utils.cloneDeep(c);\n      expect(c).toEqual({first: 1, second: [1, 2, 3], third: { fourth: {fifth: 5}}});\n      expect(z).toEqual({first: 1, second: [1, 2, 3], third: { fourth: {fifth: 5}}});\n    });\n    it('Array[0] changed in z only', () => {\n      const z = Utils.cloneDeep(c);\n      z.second[0] = 0;\n      expect(c).toEqual({first: 1, second: [1, 2, 3], third: { fourth: {fifth: 5}}});\n      expect(z).toEqual({first: 1, second: [0, 2, 3], third: { fourth: {fifth: 5}}});\n    });\n    it('nested firth element changed only in z', () => {\n      const z = Utils.cloneDeep(c);\n      z.third.fourth.fifth = 'diff';\n      expect(c).toEqual({first: 1, second: [1, 2, 3], third: { fourth: {fifth: 5}}});\n      expect(z).toEqual({first: 1, second: [1, 2, 3], third: { fourth: {fifth: 'diff'}}});\n    });\n    it('nested array only has one item changed', () => {\n      const z = Utils.cloneDeep(d);\n      z.first[1] = 'two';\n      z.first[2][2] = 6;\n      expect(d).toEqual({first: [1, [2, 3], ['four', 'five', 'six']]});\n      expect(z).toEqual({first: [1, 'two',  ['four', 'five', 6]]});\n    });\n    it('skip __ items so it mods both instance', () => {\n      const z = Utils.cloneDeep(e);\n      z.__skip.second = 'two';\n      expect(e).toEqual({first: 1, __skip: {second: 'two'}}); // TODO support clone deep of function workaround\n      expect(z).toEqual({first: 1, __skip: {second: 'two'}});\n    });\n    it('correctly copy _ item', () => {\n      const z = Utils.cloneDeep(f);\n      z._dontskip.second = 'two';\n      expect(f).toEqual({first: 1, _dontskip: {second: 2}});\n      expect(z).toEqual({first: 1, _dontskip: {second: 'two'}});\n    });\n  });\n  describe('removeInternalAndSame', () => {\n    it('should remove internal and same', () => {\n      const a = {first: 1, second: 'text', _skip: {second: 2}, arr: [1, 'second', 3]};\n      const b = {first: 1, second: 'text'};\n      Utils.removeInternalAndSame(a, b);\n      expect(a).toEqual({arr: [1, 'second', 3]});\n    });\n    it('should not remove items in an array', () => {\n      const a = {arr: [1, 2, 3]};\n      const b = {arr: [1, 3]};\n      Utils.removeInternalAndSame(a, b);\n      expect(a).toEqual({arr: [1, 2, 3]});\n    });\n    it('should remove nested object, and make empty', () => {\n      const a = {obj1: {first: 1, nested: {second: 2}}, obj2: {first: 1, second: 2}};\n      const b = {obj1: {first: 1, nested: {second: 2}}, obj2: {first: 1, second: 2}};\n      Utils.removeInternalAndSame(a, b);\n      expect(a).toEqual({});\n    });\n    it('should remove nested object, and make empty - part 2', () => {\n      const a = {obj1: {first: 1, nested: {second: 2}}, obj2: {first: 1, second: 2}};\n      const b = {obj1: {first: 1}, obj2: {first: 1, second: 2}};\n      Utils.removeInternalAndSame(a, b);\n      expect(a).toEqual({obj1: {nested: {second: 2}}});\n    });\n  });\n\n  // Obsolete functions are tested indirectly through gridstack usage\n\n  describe('getElements', () => {\n    beforeEach(() => {\n      document.body.innerHTML = `\n        <div id=\"123\">numeric id</div>\n        <div id=\"regular-id\">regular id</div>\n        <div class=\"test-class\">class element</div>\n        <div class=\"another-class\">another class</div>\n        <div id=\"shadow-host\"></div>\n      `;\n    });\n\n    it('should get element by numeric id', () => {\n      const elements = Utils.getElements('123');\n      expect(elements.length).toBe(1);\n      expect(elements[0].textContent).toBe('numeric id');\n    });\n\n    it('should get element by regular id with #', () => {\n      const elements = Utils.getElements('#regular-id');\n      expect(elements.length).toBe(1);\n      expect(elements[0].textContent).toBe('regular id');\n    });\n\n    it('should get elements by class with .', () => {\n      const elements = Utils.getElements('.test-class');\n      expect(elements.length).toBe(1);\n      expect(elements[0].textContent).toBe('class element');\n    });\n\n    it('should get elements by class name without dot', () => {\n      const elements = Utils.getElements('test-class');\n      expect(elements.length).toBe(1);\n      expect(elements[0].textContent).toBe('class element');\n    });\n\n    it('should get element by id without #', () => {\n      const elements = Utils.getElements('regular-id');\n      expect(elements.length).toBe(1);\n      expect(elements[0].textContent).toBe('regular id');\n    });\n\n    it('should return empty array for non-existent selector', () => {\n      const elements = Utils.getElements('non-existent');\n      expect(elements.length).toBe(0);\n    });\n\n    it('should return the element itself if passed', () => {\n      const el = document.getElementById('regular-id');\n      const elements = Utils.getElements(el);\n      expect(elements.length).toBe(1);\n      expect(elements[0]).toBe(el);\n    });\n  });\n\n  describe('getElement', () => {\n    beforeEach(() => {\n      document.body.innerHTML = `\n        <div id=\"123\">numeric id</div>\n        <div id=\"regular-id\">regular id</div>\n        <div class=\"test-class\">class element</div>\n        <div data-test=\"attribute\">attribute element</div>\n      `;\n    });\n\n    it('should get element by id with #', () => {\n      const element = Utils.getElement('#regular-id');\n      expect(element.textContent).toBe('regular id');\n    });\n\n    it('should get element by numeric id', () => {\n      const element = Utils.getElement('123');\n      expect(element.textContent).toBe('numeric id');\n    });\n\n    it('should get element by class with .', () => {\n      const element = Utils.getElement('.test-class');\n      expect(element.textContent).toBe('class element');\n    });\n\n    it('should get element by attribute selector', () => {\n      const element = Utils.getElement('[data-test=\"attribute\"]');\n      expect(element.textContent).toBe('attribute element');\n    });\n\n    it('should get element by tag name', () => {\n      const element = Utils.getElement('div');\n      expect(element.tagName).toBe('DIV');\n    });\n\n    it('should return null for empty string', () => {\n      const element = Utils.getElement('');\n      expect(element).toBeNull();\n    });\n\n    it('should return the element itself if passed', () => {\n      const el = document.getElementById('regular-id');\n      const element = Utils.getElement(el);\n      expect(element).toBe(el);\n    });\n  });\n\n  describe('lazyLoad', () => {\n    it('should return true if node has lazyLoad', () => {\n      const node: any = { lazyLoad: true };\n      expect(Utils.lazyLoad(node)).toBe(true);\n    });\n\n    it('should return true if grid has lazyLoad and node does not override', () => {\n      const node: any = { grid: { opts: { lazyLoad: true } } };\n      expect(Utils.lazyLoad(node)).toBe(true);\n    });\n\n    it('should return false if node explicitly disables lazyLoad', () => {\n      const node: any = { lazyLoad: false, grid: { opts: { lazyLoad: true } } };\n      expect(Utils.lazyLoad(node)).toBe(false);\n    });\n\n    it('should return false if no lazyLoad settings', () => {\n      const node: any = { grid: { opts: {} } };\n      expect(Utils.lazyLoad(node)).toBeFalsy();\n    });\n  });\n\n  describe('createDiv', () => {\n    it('should create div with classes', () => {\n      const div = Utils.createDiv(['class1', 'class2']);\n      expect(div.tagName).toBe('DIV');\n      expect(div.classList.contains('class1')).toBe(true);\n      expect(div.classList.contains('class2')).toBe(true);\n    });\n\n    it('should create div and append to parent', () => {\n      const parent = document.createElement('div');\n      const div = Utils.createDiv(['test-class'], parent);\n      expect(parent.children.length).toBe(1);\n      expect(parent.children[0]).toBe(div);\n    });\n\n    it('should skip empty class names', () => {\n      const div = Utils.createDiv(['class1', '', 'class2']);\n      expect(div.classList.contains('class1')).toBe(true);\n      expect(div.classList.contains('class2')).toBe(true);\n      expect(div.classList.length).toBe(2);\n    });\n  });\n\n  describe('shouldSizeToContent', () => {\n    it('should return true when node has sizeToContent true', () => {\n      const node: any = { grid: {}, sizeToContent: true };\n      expect(Utils.shouldSizeToContent(node)).toBe(true);\n    });\n\n    it('should return true when grid has sizeToContent and node does not override', () => {\n      const node: any = { grid: { opts: { sizeToContent: true } } };\n      expect(Utils.shouldSizeToContent(node)).toBe(true);\n    });\n\n    it('should return false when node explicitly disables sizeToContent', () => {\n      const node: any = { grid: { opts: { sizeToContent: true } }, sizeToContent: false };\n      expect(Utils.shouldSizeToContent(node)).toBe(false);\n    });\n\n    it('should return true for numeric sizeToContent', () => {\n      const node: any = { grid: {}, sizeToContent: 5 };\n      expect(Utils.shouldSizeToContent(node)).toBe(true);\n    });\n\n    it('should return false for numeric sizeToContent in strict mode', () => {\n      const node: any = { grid: { opts: {} }, sizeToContent: 5 };\n      expect(Utils.shouldSizeToContent(node, true)).toBe(false);\n    });\n\n    it('should return true for boolean true in strict mode', () => {\n      const node: any = { grid: {}, sizeToContent: true };\n      expect(Utils.shouldSizeToContent(node, true)).toBe(true);\n    });\n\n    it('should return false when no grid', () => {\n      const node: any = { sizeToContent: true };\n      expect(Utils.shouldSizeToContent(node)).toBeFalsy();\n    });\n  });\n\n  describe('isTouching', () => {\n    it('should return true for touching rectangles', () => {\n      const a = { x: 0, y: 0, w: 2, h: 2 };\n      const b = { x: 2, y: 0, w: 2, h: 2 };\n      expect(Utils.isTouching(a, b)).toBe(true);\n    });\n\n    it('should return true for corner touching', () => {\n      const a = { x: 0, y: 0, w: 2, h: 2 };\n      const b = { x: 2, y: 2, w: 2, h: 2 };\n      expect(Utils.isTouching(a, b)).toBe(true);\n    });\n\n    it('should return false for non-touching rectangles', () => {\n      const a = { x: 0, y: 0, w: 2, h: 2 };\n      const b = { x: 3, y: 3, w: 2, h: 2 };\n      expect(Utils.isTouching(a, b)).toBe(false);\n    });\n  });\n\n  describe('areaIntercept and area', () => {\n    it('should calculate overlapping area', () => {\n      const a = { x: 0, y: 0, w: 3, h: 3 };\n      const b = { x: 1, y: 1, w: 3, h: 3 };\n      expect(Utils.areaIntercept(a, b)).toBe(4); // 2x2 overlap\n    });\n\n    it('should return 0 for non-overlapping rectangles', () => {\n      const a = { x: 0, y: 0, w: 2, h: 2 };\n      const b = { x: 3, y: 3, w: 2, h: 2 };\n      expect(Utils.areaIntercept(a, b)).toBe(0);\n    });\n\n    it('should calculate total area', () => {\n      const rect = { x: 0, y: 0, w: 3, h: 4 };\n      expect(Utils.area(rect)).toBe(12);\n    });\n  });\n\n  describe('sort', () => {\n    it('should sort nodes by position ascending', () => {\n      const nodes: any = [\n        { x: 2, y: 1 },\n        { x: 1, y: 0 },\n        { x: 0, y: 1 }\n      ];\n      const sorted = Utils.sort(nodes);\n      expect(sorted[0].x).toBe(1); // y:0, x:1\n      expect(sorted[1].x).toBe(0); // y:1, x:0  \n      expect(sorted[2].x).toBe(2); // y:1, x:2\n    });\n\n    it('should sort nodes by position descending', () => {\n      const nodes: any = [\n        { x: 1, y: 0 },\n        { x: 0, y: 1 },\n        { x: 2, y: 1 }\n      ];\n      const sorted = Utils.sort(nodes, -1);\n      expect(sorted[0].x).toBe(2); // y:1, x:2\n      expect(sorted[1].x).toBe(0); // y:1, x:0\n      expect(sorted[2].x).toBe(1); // y:0, x:1\n    });\n\n    it('should handle undefined coordinates', () => {\n      const nodes: any = [\n        { x: 1 },\n        { y: 1 },\n        { x: 0, y: 0 }\n      ];\n      const sorted = Utils.sort(nodes);\n      expect(sorted[0].x).toBe(0); // defined coordinates come first\n    });\n  });\n\n  describe('find', () => {\n    it('should find node by id', () => {\n      const nodes: any = [\n        { id: 'node1', x: 0 },\n        { id: 'node2', x: 1 },\n        { id: 'node3', x: 2 }\n      ];\n      const found = Utils.find(nodes, 'node2');\n      expect(found.x).toBe(1);\n    });\n\n    it('should return undefined for non-existent id', () => {\n      const nodes: any = [{ id: 'node1' }];\n      const found = Utils.find(nodes, 'node2');\n      expect(found).toBeUndefined();\n    });\n\n    it('should return undefined for empty id', () => {\n      const nodes: any = [{ id: 'node1' }];\n      const found = Utils.find(nodes, '');\n      expect(found).toBeUndefined();\n    });\n  });\n\n  describe('toNumber', () => {\n    it('should convert string to number', () => {\n      expect(Utils.toNumber('42')).toBe(42);\n      expect(Utils.toNumber('3.14')).toBe(3.14);\n    });\n\n    it('should return undefined for null', () => {\n      expect(Utils.toNumber(null)).toBeUndefined();\n    });\n\n    it('should return undefined for empty string', () => {\n      expect(Utils.toNumber('')).toBeUndefined();\n    });\n  });\n\n  describe('same', () => {\n    it('should return true for primitive equality', () => {\n      expect(Utils.same(5, 5)).toBe(true);\n      expect(Utils.same('test', 'test')).toBe(true);\n      expect(Utils.same(true, true)).toBe(true);\n    });\n\n    it('should return false for primitive inequality', () => {\n      expect(Utils.same(5, 6)).toBe(false);\n      expect(Utils.same('test', 'other')).toBe(false);\n    });\n\n    it('should return true for objects with same properties', () => {\n      expect(Utils.same({ a: 1, b: 2 }, { a: 1, b: 2 })).toBe(true);\n    });\n\n    it('should return false for objects with different properties', () => {\n      expect(Utils.same({ a: 1, b: 2 }, { a: 1, b: 3 })).toBe(false);\n    });\n\n    it('should return false for objects with different number of properties', () => {\n      expect(Utils.same({ a: 1 }, { a: 1, b: 2 })).toBe(false);\n    });\n\n    it('should return false for different types', () => {\n      expect(Utils.same(5, '5')).toBe(true); // same uses == comparison for primitives\n      expect(Utils.same({}, [])).toBe(true); // both are objects, same number of keys (0)\n    });\n  });\n\n  describe('copyPos', () => {\n    it('should copy position properties', () => {\n      const target: any = {};\n      const source: any = { x: 1, y: 2, w: 3, h: 4 };\n      const result = Utils.copyPos(target, source);\n      \n      expect(result).toBe(target);\n      expect(target.x).toBe(1);\n      expect(target.y).toBe(2);\n      expect(target.w).toBe(3);\n      expect(target.h).toBe(4);\n    });\n\n    it('should copy min/max constraints when requested', () => {\n      const target: any = {};\n      const source: any = { minW: 1, minH: 2, maxW: 10, maxH: 20 };\n      Utils.copyPos(target, source, true);\n      \n      expect(target.minW).toBe(1);\n      expect(target.minH).toBe(2);\n      expect(target.maxW).toBe(10);\n      expect(target.maxH).toBe(20);\n    });\n\n    it('should not copy undefined properties', () => {\n      const target: any = { x: 5 };\n      const source: any = { y: 2 };\n      Utils.copyPos(target, source);\n      \n      expect(target.x).toBe(5); // unchanged\n      expect(target.y).toBe(2);\n    });\n  });\n\n  describe('samePos', () => {\n    it('should return true for same positions', () => {\n      const a = { x: 1, y: 2, w: 3, h: 4 };\n      const b = { x: 1, y: 2, w: 3, h: 4 };\n      expect(Utils.samePos(a, b)).toBe(true);\n    });\n\n    it('should return false for different positions', () => {\n      const a = { x: 1, y: 2, w: 3, h: 4 };\n      const b = { x: 1, y: 2, w: 3, h: 5 };\n      expect(Utils.samePos(a, b)).toBe(false);\n    });\n\n    it('should handle default width/height of 1', () => {\n      const a = { x: 1, y: 2 };\n      const b = { x: 1, y: 2, w: 1, h: 1 };\n      expect(Utils.samePos(a, b)).toBe(true);\n    });\n\n    it('should return false for null/undefined', () => {\n      expect(Utils.samePos(null, { x: 1, y: 2 })).toBeFalsy();\n      expect(Utils.samePos({ x: 1, y: 2 }, null)).toBeFalsy();\n    });\n  });\n\n  describe('sanitizeMinMax', () => {\n    it('should remove falsy min/max values', () => {\n      const node: any = { minW: 0, minH: null, maxW: undefined, maxH: 5 };\n      Utils.sanitizeMinMax(node);\n      \n      expect(node.minW).toBeUndefined();\n      expect(node.minH).toBeUndefined();\n      expect(node.maxW).toBeUndefined();\n      expect(node.maxH).toBe(5);\n    });\n  });\n\n  describe('removeInternalForSave', () => {\n    it('should remove internal fields and defaults', () => {\n      const node: any = {\n        _internal: 'value',\n        grid: {},\n        el: document.createElement('div'),\n        autoPosition: false,\n        noResize: false,\n        noMove: false,\n        locked: false,\n        w: 1,\n        h: 1,\n        x: 5,\n        y: 3\n      };\n      Utils.removeInternalForSave(node);\n      \n      expect(node._internal).toBeUndefined();\n      expect(node.grid).toBeUndefined();\n      expect(node.el).toBeUndefined();\n      expect(node.autoPosition).toBeUndefined();\n      expect(node.noResize).toBeUndefined();\n      expect(node.noMove).toBeUndefined();\n      expect(node.locked).toBeUndefined();\n      expect(node.w).toBeUndefined();\n      expect(node.h).toBeUndefined();\n      expect(node.x).toBe(5);\n      expect(node.y).toBe(3);\n    });\n\n    it('should keep el when removeEl is false', () => {\n      const el = document.createElement('div');\n      const node: any = { el };\n      Utils.removeInternalForSave(node, false);\n      \n      expect(node.el).toBe(el);\n    });\n  });\n\n  describe('throttle', () => {\n    it('should throttle function calls', async () => {\n      let callCount = 0;\n      const throttled = Utils.throttle(() => callCount++, 50);\n      \n      throttled();\n      throttled();\n      throttled();\n      \n      expect(callCount).toBe(0);\n      \n      await new Promise(resolve => setTimeout(resolve, 60));\n      expect(callCount).toBe(1);\n    });\n  });\n\n  describe('cloneNode', () => {\n    it('should clone HTML element and remove id', () => {\n      const original = document.createElement('div');\n      original.id = 'original-id';\n      original.className = 'test-class';\n      original.innerHTML = '<span>content</span>';\n      \n      const cloned = Utils.cloneNode(original);\n      \n      expect(cloned.id).toBe('');\n      expect(cloned.className).toBe('test-class');\n      expect(cloned.innerHTML).toBe('<span>content</span>');\n      expect(cloned).not.toBe(original);\n    });\n  });\n\n  describe('appendTo', () => {\n    it('should append element to parent by selector', () => {\n      document.body.innerHTML = '<div id=\"parent\"></div>';\n      const child = document.createElement('div');\n      \n      Utils.appendTo(child, '#parent');\n      \n      const parent = document.getElementById('parent');\n      expect(parent.children[0]).toBe(child);\n    });\n\n    it('should append element to parent element', () => {\n      const parent = document.createElement('div');\n      const child = document.createElement('div');\n      \n      Utils.appendTo(child, parent);\n      \n      expect(parent.children[0]).toBe(child);\n    });\n\n    it('should handle non-existent parent gracefully', () => {\n      const child = document.createElement('div');\n      \n      expect(() => Utils.appendTo(child, '#non-existent')).not.toThrow();\n    });\n  });\n\n  describe('addElStyles', () => {\n    it('should add styles to element', () => {\n      const el = document.createElement('div');\n      const styles = {\n        width: '100px',\n        height: '200px',\n        color: 'red'\n      };\n      \n      Utils.addElStyles(el, styles);\n      \n      expect(el.style.width).toBe('100px');\n      expect(el.style.height).toBe('200px');\n      expect(el.style.color).toBe('red');\n    });\n\n    it('should handle array styles (fallback values)', () => {\n      const el = document.createElement('div');\n      const styles = {\n        display: ['-webkit-flex', 'flex']\n      };\n      \n      Utils.addElStyles(el, styles);\n      \n      expect(el.style.display).toBe('flex');\n    });\n  });\n\n  describe('initEvent', () => {\n    it('should create event object with properties', () => {\n      const originalEvent = new MouseEvent('mousedown', {\n        clientX: 100,\n        clientY: 200,\n        altKey: true\n      });\n      \n      const newEvent = Utils.initEvent<any>(originalEvent, { type: 'customEvent' });\n      \n      expect(newEvent.type).toBe('customEvent');\n      expect(newEvent.clientX).toBe(100);\n      expect(newEvent.clientY).toBe(200);\n      expect(newEvent.altKey).toBe(true);\n      expect(newEvent.button).toBe(0);\n      expect(newEvent.buttons).toBe(1);\n    });\n  });\n\n  describe('simulateMouseEvent', () => {\n    it('should handle Touch object', () => {\n      const target = document.createElement('div');\n      \n      // Test with simplified Touch-like object\n      const touchObj = {\n        screenX: 100,\n        screenY: 200,\n        clientX: 100,\n        clientY: 200,\n        target: target\n      };\n      \n      // Just test that it tries to create an event\n      // The actual MouseEvent construction is tested at runtime\n      expect(typeof Utils.simulateMouseEvent).toBe('function');\n    });\n  });\n\n  describe('getValuesFromTransformedElement', () => {\n    it('should get transform values from parent', () => {\n      const parent = document.createElement('div');\n      document.body.appendChild(parent);\n      \n      const result = Utils.getValuesFromTransformedElement(parent);\n      \n      expect(result.xScale).toBeDefined();\n      expect(result.yScale).toBeDefined();\n      expect(result.xOffset).toBeDefined();\n      expect(result.yOffset).toBeDefined();\n      \n      document.body.removeChild(parent);\n    });\n  });\n\n  describe('swap', () => {\n    it('should swap object properties', () => {\n      const obj: any = { a: 'first', b: 'second' };\n      \n      Utils.swap(obj, 'a', 'b');\n      \n      expect(obj.a).toBe('second');\n      expect(obj.b).toBe('first');\n    });\n\n    it('should handle null object gracefully', () => {\n      expect(() => Utils.swap(null, 'a', 'b')).not.toThrow();\n    });\n  });\n\n  describe('canBeRotated', () => {\n    it('should return true for rotatable node', () => {\n      const node: any = { w: 2, h: 3, grid: { opts: {} } };\n      expect(Utils.canBeRotated(node)).toBe(true);\n    });\n\n    it('should return false for square node', () => {\n      const node: any = { w: 2, h: 2 };\n      expect(Utils.canBeRotated(node)).toBe(false);\n    });\n\n    it('should return false for locked node', () => {\n      const node: any = { w: 2, h: 3, locked: true };\n      expect(Utils.canBeRotated(node)).toBe(false);\n    });\n\n    it('should return false for no-resize node', () => {\n      const node: any = { w: 2, h: 3, noResize: true };\n      expect(Utils.canBeRotated(node)).toBe(false);\n    });\n\n    it('should return false when grid disables resize', () => {\n      const node: any = { w: 2, h: 3, grid: { opts: { disableResize: true } } };\n      expect(Utils.canBeRotated(node)).toBe(false);\n    });\n\n    it('should return false for constrained width', () => {\n      const node: any = { w: 2, h: 3, minW: 2, maxW: 2 };\n      expect(Utils.canBeRotated(node)).toBe(false);\n    });\n\n    it('should return false for constrained height', () => {\n      const node: any = { w: 2, h: 3, minH: 3, maxH: 3 };\n      expect(Utils.canBeRotated(node)).toBe(false);\n    });\n\n    it('should return false for null node', () => {\n      expect(Utils.canBeRotated(null)).toBe(false);\n    });\n  });\n\n  describe('parseHeight edge cases', () => {\n    it('should handle auto and empty string', () => {\n      expect(Utils.parseHeight('auto')).toEqual({ h: 0, unit: 'px' });\n      expect(Utils.parseHeight('')).toEqual({ h: 0, unit: 'px' });\n    });\n  });\n\n  describe('updateScrollPosition', () => {\n    it('should update scroll position', () => {\n      const container = document.createElement('div');\n      container.style.overflow = 'auto';\n      container.style.height = '100px';\n      document.body.appendChild(container);\n\n      const el = document.createElement('div');\n      container.appendChild(el);\n\n      const position = { top: 50 };\n      Utils.updateScrollPosition(el, position, 10);\n\n      // Test that it doesn't throw and position is a number\n      expect(typeof position.top).toBe('number');\n\n      document.body.removeChild(container);\n    });\n  });\n\n  describe('updateScrollResize', () => {\n    it('should handle scroll resize events', () => {\n      // Test that the function exists and can be called\n      expect(typeof Utils.updateScrollResize).toBe('function');\n      \n      // Simple test to avoid jsdom scrollBy issues\n      const el = document.createElement('div');\n      const mockEvent = { clientY: 50 } as MouseEvent;\n      \n      // The function implementation involves DOM scrolling which is complex in jsdom\n      // We just verify it's callable without extensive mocking\n      try {\n        Utils.updateScrollResize(mockEvent, el, 20);\n      } catch (e) {\n        // Expected in test environment due to scrollBy not being available\n        expect(e.message).toContain('scrollBy');\n      }\n    });\n  });\n});\n"
  },
  {
    "path": "src/dd-base-impl.ts",
    "content": "/**\n * dd-base-impl.ts 12.4.3\n * Copyright (c) 2021-2025  Alain Dumesny - see GridStack root license\n */\n\n/**\n * Type for event callback functions used in drag & drop operations.\n * Can return boolean to indicate if the event should continue propagation.\n */\nexport type EventCallback = (event: Event) => boolean|void;\n\n/**\n * Abstract base class for all drag & drop implementations.\n * Provides common functionality for event handling, enable/disable state,\n * and lifecycle management used by draggable, droppable, and resizable implementations.\n */\nexport abstract class DDBaseImplement {\n  /**\n   * Returns the current disabled state.\n   * Note: Use enable()/disable() methods to change state as other operations need to happen.\n   */\n  public get disabled(): boolean   { return this._disabled; }\n\n  /** @internal */\n  protected _disabled: boolean; // initial state to differentiate from false\n  /** @internal */\n  protected _eventRegister: {\n    [eventName: string]: EventCallback;\n  } = {};\n\n  /**\n   * Register an event callback for the specified event.\n   *\n   * @param event - Event name to listen for\n   * @param callback - Function to call when event occurs\n   */\n  public on(event: string, callback: EventCallback): void {\n    this._eventRegister[event] = callback;\n  }\n\n  /**\n   * Unregister an event callback for the specified event.\n   *\n   * @param event - Event name to stop listening for\n   */\n  public off(event: string): void {\n    delete this._eventRegister[event];\n  }\n\n  /**\n   * Enable this drag & drop implementation.\n   * Subclasses should override to perform additional setup.\n   */\n  public enable(): void {\n    this._disabled = false;\n  }\n\n  /**\n   * Disable this drag & drop implementation.\n   * Subclasses should override to perform additional cleanup.\n   */\n  public disable(): void {\n    this._disabled = true;\n  }\n\n  /**\n   * Destroy this drag & drop implementation and clean up resources.\n   * Removes all event handlers and clears internal state.\n   */\n  public destroy(): void {\n    delete this._eventRegister;\n  }\n\n  /**\n   * Trigger a registered event callback if one exists and the implementation is enabled.\n   *\n   * @param eventName - Name of the event to trigger\n   * @param event - DOM event object to pass to the callback\n   * @returns Result from the callback function, if any\n   */\n  public triggerEvent(eventName: string, event: Event): boolean|void {\n    if (!this.disabled && this._eventRegister && this._eventRegister[eventName])\n      return this._eventRegister[eventName](event);\n  }\n}\n\n/**\n * Interface for HTML elements extended with drag & drop options.\n * Used to associate DD configuration with DOM elements.\n */\nexport interface HTMLElementExtendOpt<T> {\n  /** The HTML element being extended */\n  el: HTMLElement;\n  /** The drag & drop options/configuration */\n  option: T;\n  /** Method to update the options and return the DD implementation */\n  updateOption(T): DDBaseImplement;\n}\n"
  },
  {
    "path": "src/dd-draggable.ts",
    "content": "/**\n * dd-draggable.ts 12.4.3\n * Copyright (c) 2021-2025  Alain Dumesny - see GridStack root license\n */\n\nimport { DDManager } from './dd-manager';\nimport { DragTransform, Utils } from './utils';\nimport { DDBaseImplement, HTMLElementExtendOpt } from './dd-base-impl';\nimport { GridItemHTMLElement, DDUIData, GridStackNode, GridStackPosition, DDDragOpt } from './types';\nimport { DDElementHost } from './dd-element';\nimport { isTouch, touchend, touchmove, touchstart, pointerdown, DDTouch } from './dd-touch';\nimport { GridHTMLElement } from './gridstack';\n\ninterface DragOffset {\n  left: number;\n  top: number;\n  width: number;\n  height: number;\n  offsetLeft: number;\n  offsetTop: number;\n}\n\ninterface GridStackNodeRotate extends GridStackNode {\n  _origRotate?: GridStackPosition;\n}\n\ntype DDDragEvent = 'drag' | 'dragstart' | 'dragstop';\n\n// make sure we are not clicking on known object that handles mouseDown\nconst skipMouseDown = 'input,textarea,button,select,option,[contenteditable=\"true\"],.ui-resizable-handle';\n\n// let count = 0; // TEST\n\nexport class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt<DDDragOpt> {\n  public helper: HTMLElement; // used by GridStackDDNative\n\n  /** @internal */\n  protected mouseDownEvent: MouseEvent;\n  /** @internal */\n  protected dragOffset: DragOffset;\n  /** @internal */\n  protected dragElementOriginStyle: Array<string>;\n  /** @internal */\n  protected dragEls: HTMLElement[];\n  /** @internal true while we are dragging an item around */\n  protected dragging: boolean;\n  /** @internal last drag event */\n  protected lastDrag: DragEvent;\n  /** @internal */\n  protected parentOriginStylePosition: string;\n  /** @internal */\n  protected helperContainment: HTMLElement;\n  /** @internal properties we change during dragging, and restore back */\n  protected static originStyleProp = ['width', 'height', 'transform', 'transform-origin', 'transition', 'pointerEvents', 'position', 'left', 'top', 'minWidth', 'willChange'];\n  /** @internal pause before we call the actual drag hit collision code */\n  protected dragTimeout: number;\n  /** @internal */\n  protected dragTransform: DragTransform = {\n    xScale: 1,\n    yScale: 1,\n    xOffset: 0,\n    yOffset: 0\n  };\n\n  constructor(public el: GridItemHTMLElement, public option: DDDragOpt = {}) {\n    super();\n\n    // get the element that is actually supposed to be dragged by\n    const handleName = option?.handle?.substring(1);\n    const n = el.gridstackNode;\n    this.dragEls = !handleName || el.classList.contains(handleName) ? [el] : (n?.subGrid ? [el.querySelector(option.handle) || el] : Array.from(el.querySelectorAll(option.handle)));\n    if (this.dragEls.length === 0) {\n      this.dragEls = [el];\n    }\n    // create var event binding so we can easily remove and still look like TS methods (unlike anonymous functions)\n    this._mouseDown = this._mouseDown.bind(this);\n    this._mouseMove = this._mouseMove.bind(this);\n    this._mouseUp = this._mouseUp.bind(this);\n    this._keyEvent = this._keyEvent.bind(this);\n    this.enable();\n  }\n\n  public on(event: DDDragEvent, callback: (event: DragEvent) => void): void {\n    super.on(event, callback);\n  }\n\n  public off(event: DDDragEvent): void {\n    super.off(event);\n  }\n\n  public enable(): void {\n    if (this.disabled === false) return;\n    super.enable();\n    this.dragEls.forEach(dragEl => {\n      dragEl.addEventListener('mousedown', this._mouseDown);\n      if (isTouch) {\n        dragEl.addEventListener('touchstart', touchstart);\n        dragEl.addEventListener('pointerdown', pointerdown);\n        // dragEl.style.touchAction = 'none'; // not needed unlike pointerdown doc comment\n      }\n    });\n    this.el.classList.remove('ui-draggable-disabled');\n  }\n\n  public disable(forDestroy = false): void {\n    if (this.disabled === true) return;\n    super.disable();\n    this.dragEls.forEach(dragEl => {\n      dragEl.removeEventListener('mousedown', this._mouseDown);\n      if (isTouch) {\n        dragEl.removeEventListener('touchstart', touchstart);\n        dragEl.removeEventListener('pointerdown', pointerdown);\n      }\n    });\n    if (!forDestroy) this.el.classList.add('ui-draggable-disabled');\n  }\n\n  public destroy(): void {\n    if (this.dragTimeout) window.clearTimeout(this.dragTimeout);\n    delete this.dragTimeout;\n    if (this.mouseDownEvent) this._mouseUp(this.mouseDownEvent);\n    this.disable(true);\n    delete this.el;\n    delete this.helper;\n    delete this.option;\n    super.destroy();\n  }\n\n  public updateOption(opts: DDDragOpt): DDDraggable {\n    Object.keys(opts).forEach(key => this.option[key] = opts[key]);\n    return this;\n  }\n\n  /** @internal call when mouse goes down before a dragstart happens */\n  protected _mouseDown(e: MouseEvent): boolean {\n    // if real brower event (trusted:true vs false for our simulated ones) and we didn't correctly clear the last touch event, clear things up\n    if (DDTouch.touchHandled && e.isTrusted) DDTouch.touchHandled = false;\n\n    // don't let more than one widget handle mouseStart\n    if (DDManager.mouseHandled) return;\n    if (e.button !== 0) return true; // only left click\n\n    // make sure we are not clicking on known object that handles mouseDown, or ones supplied by the user\n    if (!this.dragEls.find(el => el === e.target) && (e.target as HTMLElement).closest(skipMouseDown)) return true;\n    if (this.option.cancel) {\n      if ((e.target as HTMLElement).closest(this.option.cancel)) return true;\n    }\n\n    this.mouseDownEvent = e;\n    delete this.dragging;\n    delete DDManager.dragElement;\n    delete DDManager.dropElement;\n    // document handler so we can continue receiving moves as the item is 'fixed' position, and capture=true so WE get a first crack\n    document.addEventListener('mousemove', this._mouseMove, { capture: true, passive: true }); // true=capture, not bubble\n    document.addEventListener('mouseup', this._mouseUp, true);\n    if (isTouch) {\n      e.currentTarget.addEventListener('touchmove', touchmove);\n      e.currentTarget.addEventListener('touchend', touchend);\n    }\n\n    e.preventDefault();\n    // preventDefault() prevents blur event which occurs just after mousedown event.\n    // if an editable content has focus, then blur must be call\n    if (document.activeElement) (document.activeElement as HTMLElement).blur();\n\n    DDManager.mouseHandled = true;\n    return true;\n  }\n\n  /** @internal method to call actual drag event */\n  protected _callDrag(e: DragEvent): void {\n    if (!this.dragging) return;\n    const ev = Utils.initEvent<DragEvent>(e, { target: this.el, type: 'drag' });\n    if (this.option.drag) {\n      this.option.drag(ev, this.ui());\n    }\n    this.triggerEvent('drag', ev);\n  }\n\n  /** @internal called when the main page (after successful mousedown) receives a move event to drag the item around the screen */\n  protected _mouseMove(e: DragEvent): boolean {\n    // console.log(`${count++} move ${e.x},${e.y}`)\n    const s = this.mouseDownEvent;\n    this.lastDrag = e;\n\n    if (this.dragging) {\n      this._dragFollow(e);\n      // delay actual grid handling drag until we pause for a while if set\n      if (DDManager.pauseDrag) {\n        const pause = Number.isInteger(DDManager.pauseDrag) ? DDManager.pauseDrag as number : 100;\n        if (this.dragTimeout) window.clearTimeout(this.dragTimeout);\n        this.dragTimeout = window.setTimeout(() => this._callDrag(e), pause);\n      } else {\n        this._callDrag(e);\n      }\n    } else if (Math.abs(e.x - s.x) + Math.abs(e.y - s.y) > 3) {\n      /**\n       * don't start unless we've moved at least 3 pixels\n       */\n      this.dragging = true;\n      DDManager.dragElement = this;\n      // if we're dragging an actual grid item, set the current drop as the grid (to detect enter/leave)\n      const grid = this.el.gridstackNode?.grid;\n      if (grid) {\n        DDManager.dropElement = (grid.el as DDElementHost).ddElement.ddDroppable;\n      } else {\n        delete DDManager.dropElement;\n      }\n      this.helper = this._createHelper();\n      this._setupHelperContainmentStyle();\n      this.dragTransform = Utils.getValuesFromTransformedElement(this.helperContainment);\n      this.dragOffset = this._getDragOffset(e, this.el, this.helperContainment);\n      this._setupHelperStyle(e);\n\n      const ev = Utils.initEvent<DragEvent>(e, { target: this.el, type: 'dragstart' });\n      if (this.option.start) {\n        this.option.start(ev, this.ui());\n      }\n      this.triggerEvent('dragstart', ev);\n      // now track keyboard events to cancel or rotate\n      document.addEventListener('keydown', this._keyEvent);\n    }\n    // e.preventDefault(); // passive = true. OLD: was needed otherwise we get text sweep text selection as we drag around\n    return true;\n  }\n\n  /** @internal call when the mouse gets released to drop the item at current location */\n  protected _mouseUp(e: MouseEvent): void {\n    document.removeEventListener('mousemove', this._mouseMove, true);\n    document.removeEventListener('mouseup', this._mouseUp, true);\n    if (isTouch && e.currentTarget) { // destroy() during nested grid call us again wit fake _mouseUp\n      e.currentTarget.removeEventListener('touchmove', touchmove, true);\n      e.currentTarget.removeEventListener('touchend', touchend, true);\n    }\n    if (this.dragging) {\n      delete this.dragging;\n      delete (this.el.gridstackNode as GridStackNodeRotate)?._origRotate;\n      document.removeEventListener('keydown', this._keyEvent);\n\n      // reset the drop target if dragging over ourself (already parented, just moving during stop callback below)\n      if (DDManager.dropElement?.el === this.el.parentElement) {\n        delete DDManager.dropElement;\n      }\n\n      this.helperContainment.style.position = this.parentOriginStylePosition || null;\n      if (this.helper !== this.el) this.helper.remove(); // hide now\n      this._removeHelperStyle();\n\n      const ev = Utils.initEvent<DragEvent>(e, { target: this.el, type: 'dragstop' });\n      if (this.option.stop) {\n        this.option.stop(ev); // NOTE: destroy() will be called when removing item, so expect NULL ptr after!\n      }\n      this.triggerEvent('dragstop', ev);\n\n      // call the droppable method to receive the item\n      if (DDManager.dropElement) {\n        DDManager.dropElement.drop(e);\n      }\n    }\n    delete this.helper;\n    delete this.mouseDownEvent;\n    delete DDManager.dragElement;\n    delete DDManager.dropElement;\n    delete DDManager.mouseHandled;\n    e.preventDefault();\n  }\n\n  /** @internal call when keys are being pressed - use Esc to cancel, R to rotate */\n  protected _keyEvent(e: KeyboardEvent): void {\n    const n = this.el.gridstackNode as GridStackNodeRotate;\n    const grid = n?.grid || (DDManager.dropElement?.el as GridHTMLElement)?.gridstack;\n\n    if (e.key === 'Escape') {\n      if (n && n._origRotate) {\n        n._orig = n._origRotate;\n        delete n._origRotate;\n      }\n      grid?.cancelDrag();\n      this._mouseUp(this.mouseDownEvent);\n    } else if (n && grid && (e.key === 'r' || e.key === 'R')) {\n      if (!Utils.canBeRotated(n)) return;\n      n._origRotate = n._origRotate || { ...n._orig }; // store the real orig size in case we Esc after doing rotation\n      delete n._moving; // force rotate to happen (move waits for >50% coverage otherwise)\n      grid.setAnimation(false) // immediate rotate so _getDragOffset() gets the right dom size below\n        .rotate(n.el, { top: -this.dragOffset.offsetTop, left: -this.dragOffset.offsetLeft })\n        .setAnimation();\n      n._moving = true;\n      this.dragOffset = this._getDragOffset(this.lastDrag, n.el, this.helperContainment);\n      this.helper.style.width = this.dragOffset.width + 'px';\n      this.helper.style.height = this.dragOffset.height + 'px';\n      Utils.swap(n._orig, 'w', 'h');\n      delete n._rect;\n      this._mouseMove(this.lastDrag);\n    }\n  }\n\n  /** @internal create a clone copy (or user defined method) of the original drag item if set */\n  protected _createHelper(): HTMLElement {\n    let helper = this.el;\n    if (typeof this.option.helper === 'function') {\n      helper = this.option.helper(this.el);\n    } else if (this.option.helper === 'clone') {\n      helper = Utils.cloneNode(this.el);\n    }\n    if (!helper.parentElement) {\n      Utils.appendTo(helper, this.option.appendTo === 'parent' ? this.el.parentElement : this.option.appendTo);\n    }\n    this.dragElementOriginStyle = DDDraggable.originStyleProp.map(prop => this.el.style[prop]);\n    return helper;\n  }\n\n  /** @internal set the fix position of the dragged item */\n  protected _setupHelperStyle(e: DragEvent): DDDraggable {\n    this.helper.classList.add('ui-draggable-dragging');\n    this.el.gridstackNode?.grid?.el.classList.add('grid-stack-dragging');\n    // TODO: set all at once with style.cssText += ... ? https://stackoverflow.com/questions/3968593\n    const style = this.helper.style;\n    style.pointerEvents = 'none'; // needed for over items to get enter/leave\n    // style.cursor = 'move'; //  TODO: can't set with pointerEvents=none ! (no longer in CSS either as no-op)\n    style.width = this.dragOffset.width + 'px';\n    style.height = this.dragOffset.height + 'px';\n    style.willChange = 'left, top';\n    style.position = 'fixed'; // let us drag between grids by not clipping as parent .grid-stack is position: 'relative'\n    this._dragFollow(e); // now position it\n    style.transition = 'none'; // show up instantly\n    setTimeout(() => {\n      if (this.helper) {\n        style.transition = null; // recover animation\n      }\n    }, 0);\n    return this;\n  }\n\n  /** @internal restore back the original style before dragging */\n  protected _removeHelperStyle(): DDDraggable {\n    this.helper.classList.remove('ui-draggable-dragging');\n    this.el.gridstackNode?.grid?.el.classList.remove('grid-stack-dragging');\n    const node = (this.helper as GridItemHTMLElement)?.gridstackNode;\n    // don't bother restoring styles if we're gonna remove anyway...\n    if (!node?._isAboutToRemove && this.dragElementOriginStyle) {\n      const helper = this.helper;\n      // don't animate, otherwise we animate offseted when switching back to 'absolute' from 'fixed'.\n      // TODO: this also removes resizing animation which doesn't have this issue, but others.\n      // Ideally both would animate ('move' would immediately restore 'absolute' and adjust coordinate to match,\n      // then trigger a delay (repaint) to restore to final dest with animate) but then we need to make sure 'resizestop'\n      // is called AFTER 'transitionend' event is received (see https://github.com/gridstack/gridstack.js/issues/2033)\n      const transition = this.dragElementOriginStyle['transition'] || null;\n      helper.style.transition = this.dragElementOriginStyle['transition'] = 'none'; // can't be NULL #1973\n      DDDraggable.originStyleProp.forEach(prop => helper.style[prop] = this.dragElementOriginStyle[prop] || null);\n      setTimeout(() => helper.style.transition = transition, 50); // recover animation from saved vars after a pause (0 isn't enough #1973)\n    }\n    delete this.dragElementOriginStyle;\n    return this;\n  }\n\n  /** @internal updates the top/left position to follow the mouse */\n  protected _dragFollow(e: DragEvent): void {\n    const containmentRect = { left: 0, top: 0 };\n    // if (this.helper.style.position === 'absolute') { // we use 'fixed'\n    //   const { left, top } = this.helperContainment.getBoundingClientRect();\n    //   containmentRect = { left, top };\n    // }\n    const style = this.helper.style;\n    const offset = this.dragOffset;\n    style.left = (e.clientX + offset.offsetLeft - containmentRect.left) * this.dragTransform.xScale + 'px';\n    style.top = (e.clientY + offset.offsetTop - containmentRect.top) * this.dragTransform.yScale + 'px';\n  }\n\n  /** @internal */\n  protected _setupHelperContainmentStyle(): DDDraggable {\n    this.helperContainment = this.helper.parentElement;\n    if (this.helper.style.position !== 'fixed') {\n      this.parentOriginStylePosition = this.helperContainment.style.position;\n      if (getComputedStyle(this.helperContainment).position.match(/static/)) {\n        this.helperContainment.style.position = 'relative';\n      }\n    }\n    return this;\n  }\n\n  /** @internal */\n  protected _getDragOffset(event: DragEvent, el: HTMLElement, parent: HTMLElement): DragOffset {\n\n    // in case ancestor has transform/perspective css properties that change the viewpoint\n    let xformOffsetX = 0;\n    let xformOffsetY = 0;\n    if (parent) {\n      xformOffsetX = this.dragTransform.xOffset;\n      xformOffsetY = this.dragTransform.yOffset;\n    }\n\n    const targetOffset = el.getBoundingClientRect();\n    return {\n      left: targetOffset.left,\n      top: targetOffset.top,\n      offsetLeft: - event.clientX + targetOffset.left - xformOffsetX,\n      offsetTop: - event.clientY + targetOffset.top - xformOffsetY,\n      width: targetOffset.width * this.dragTransform.xScale,\n      height: targetOffset.height * this.dragTransform.yScale\n    };\n  }\n\n  /** @internal TODO: set to public as called by DDDroppable! */\n  public ui(): DDUIData {\n    const containmentEl = this.el.parentElement;\n    const containmentRect = containmentEl.getBoundingClientRect();\n    const offset = this.helper.getBoundingClientRect();\n    return {\n      position: { //Current CSS position of the helper as { top, left } object\n        top: (offset.top - containmentRect.top) * this.dragTransform.yScale,\n        left: (offset.left - containmentRect.left) * this.dragTransform.xScale\n      }\n      /* not used by GridStack for now...\n      helper: [this.helper], //The object arr representing the helper that's being dragged.\n      offset: { top: offset.top, left: offset.left } // Current offset position of the helper as { top, left } object.\n      */\n    };\n  }\n}\n"
  },
  {
    "path": "src/dd-droppable.ts",
    "content": "/**\n * dd-droppable.ts 12.4.3\n * Copyright (c) 2021-2025  Alain Dumesny - see GridStack root license\n */\n\nimport { DDDraggable } from './dd-draggable';\nimport { DDManager } from './dd-manager';\nimport { DDBaseImplement, HTMLElementExtendOpt } from './dd-base-impl';\nimport { Utils } from './utils';\nimport { DDElementHost } from './dd-element';\nimport { DDTouch, isTouch, pointerenter, pointerleave } from './dd-touch';\nimport { DDUIData } from './types';\n\nexport interface DDDroppableOpt {\n  accept?: string | ((el: HTMLElement) => boolean);\n  drop?: (event: DragEvent, ui: DDUIData) => void;\n  over?: (event: DragEvent, ui: DDUIData) => void;\n  out?: (event: DragEvent, ui: DDUIData) => void;\n}\n\n// let count = 0; // TEST\n\nexport class DDDroppable extends DDBaseImplement implements HTMLElementExtendOpt<DDDroppableOpt> {\n\n  public accept: (el: HTMLElement) => boolean;\n\n  constructor(public el: HTMLElement, public option: DDDroppableOpt = {}) {\n    super();\n    // create var event binding so we can easily remove and still look like TS methods (unlike anonymous functions)\n    this._mouseEnter = this._mouseEnter.bind(this);\n    this._mouseLeave = this._mouseLeave.bind(this);\n    this.enable();\n    this._setupAccept();\n  }\n\n  public on(event: 'drop' | 'dropover' | 'dropout', callback: (event: DragEvent) => void): void {\n    super.on(event, callback);\n  }\n\n  public off(event: 'drop' | 'dropover' | 'dropout'): void {\n    super.off(event);\n  }\n\n  public enable(): void {\n    if (this.disabled === false) return;\n    super.enable();\n    this.el.classList.add('ui-droppable');\n    this.el.classList.remove('ui-droppable-disabled');\n    this.el.addEventListener('mouseenter', this._mouseEnter);\n    this.el.addEventListener('mouseleave', this._mouseLeave);\n    if (isTouch) {\n      this.el.addEventListener('pointerenter', pointerenter);\n      this.el.addEventListener('pointerleave', pointerleave);\n    }\n  }\n\n  public disable(forDestroy = false): void {\n    if (this.disabled === true) return;\n    super.disable();\n    this.el.classList.remove('ui-droppable');\n    if (!forDestroy) this.el.classList.add('ui-droppable-disabled');\n    this.el.removeEventListener('mouseenter', this._mouseEnter);\n    this.el.removeEventListener('mouseleave', this._mouseLeave);\n    if (isTouch) {\n      this.el.removeEventListener('pointerenter', pointerenter);\n      this.el.removeEventListener('pointerleave', pointerleave);\n    }\n  }\n\n  public destroy(): void {\n    this.disable(true);\n    this.el.classList.remove('ui-droppable');\n    this.el.classList.remove('ui-droppable-disabled');\n    super.destroy();\n  }\n\n  public updateOption(opts: DDDroppableOpt): DDDroppable {\n    Object.keys(opts).forEach(key => this.option[key] = opts[key]);\n    this._setupAccept();\n    return this;\n  }\n\n  /** @internal called when the cursor enters our area - prepare for a possible drop and track leaving */\n  protected _mouseEnter(e: MouseEvent): void {\n    // console.log(`${count++} Enter ${this.el.id || (this.el as GridHTMLElement).gridstack.opts.id}`); // TEST\n    if (!DDManager.dragElement) return;\n    // During touch drag operations, ignore real browser-generated mouseenter events (isTrusted:true) vs our simulated ones (isTrusted:false).\n    // The browser can fire spurious mouseenter events when we dispatch simulated mousemove events.\n    if (DDTouch.touchHandled && e.isTrusted) return\n\n    if (!this._canDrop(DDManager.dragElement.el)) return;\n    e.preventDefault();\n    e.stopPropagation();\n\n    // make sure when we enter this, that the last one gets a leave FIRST to correctly cleanup as we don't always do\n    if (DDManager.dropElement && DDManager.dropElement !== this) {\n      DDManager.dropElement._mouseLeave(e as DragEvent, true); // calledByEnter = true\n    }\n    DDManager.dropElement = this;\n\n    const ev = Utils.initEvent<DragEvent>(e, { target: this.el, type: 'dropover' });\n    if (this.option.over) {\n      this.option.over(ev, this._ui(DDManager.dragElement))\n    }\n    this.triggerEvent('dropover', ev);\n    this.el.classList.add('ui-droppable-over');\n    // console.log('tracking'); // TEST\n  }\n\n  /** @internal called when the item is leaving our area, stop tracking if we had moving item */\n  protected _mouseLeave(e: MouseEvent, calledByEnter = false): void {\n    // console.log(`${count++} Leave ${this.el.id || (this.el as GridHTMLElement).gridstack.opts.id}`); // TEST\n    if (!DDManager.dragElement || DDManager.dropElement !== this) return;\n    e.preventDefault();\n    e.stopPropagation();\n\n    const ev = Utils.initEvent<DragEvent>(e, { target: this.el, type: 'dropout' });\n    if (this.option.out) {\n      this.option.out(ev, this._ui(DDManager.dragElement))\n    }\n    this.triggerEvent('dropout', ev);\n\n    if (DDManager.dropElement === this) {\n      delete DDManager.dropElement;\n      // console.log('not tracking'); // TEST\n\n      // if we're still over a parent droppable, send it an enter as we don't get one from leaving nested children\n      if (!calledByEnter) {\n        let parentDrop: DDDroppable;\n        let parent: DDElementHost = this.el.parentElement;\n        while (!parentDrop && parent) {\n          parentDrop = parent.ddElement?.ddDroppable;\n          parent = parent.parentElement;\n        }\n        if (parentDrop) {\n          parentDrop._mouseEnter(e);\n        }\n      }\n    }\n  }\n\n  /** item is being dropped on us - called by the drag mouseup handler - this calls the client drop event */\n  public drop(e: MouseEvent): void {\n    e.preventDefault();\n    const ev = Utils.initEvent<DragEvent>(e, { target: this.el, type: 'drop' });\n    if (this.option.drop) {\n      this.option.drop(ev, this._ui(DDManager.dragElement))\n    }\n    this.triggerEvent('drop', ev);\n  }\n\n  /** @internal true if element matches the string/method accept option */\n  protected _canDrop(el: HTMLElement): boolean {\n    return el && (!this.accept || this.accept(el));\n  }\n\n  /** @internal */\n  protected _setupAccept(): DDDroppable {\n    if (!this.option.accept) return this;\n    if (typeof this.option.accept === 'string') {\n      this.accept = (el: HTMLElement) => el.classList.contains(this.option.accept as string) || el.matches(this.option.accept as string);\n    } else {\n      this.accept = this.option.accept;\n    }\n    return this;\n  }\n\n  /** @internal */\n  protected _ui(drag: DDDraggable): DDUIData {\n    return {\n      draggable: drag.el,\n      ...drag.ui()\n    };\n  }\n}\n\n"
  },
  {
    "path": "src/dd-element.ts",
    "content": "/**\n * dd-elements.ts 12.4.3\n * Copyright (c) 2021-2025 Alain Dumesny - see GridStack root license\n */\n\nimport { DDResizable, DDResizableOpt } from './dd-resizable';\nimport { DDDragOpt, GridItemHTMLElement } from './types';\nimport { DDDraggable } from './dd-draggable';\nimport { DDDroppable, DDDroppableOpt } from './dd-droppable';\n\nexport interface DDElementHost extends GridItemHTMLElement {\n  ddElement?: DDElement;\n}\n\nexport class DDElement {\n\n  static init(el: DDElementHost): DDElement {\n    if (!el.ddElement) { el.ddElement = new DDElement(el); }\n    return el.ddElement;\n  }\n\n  public ddDraggable?: DDDraggable;\n  public ddDroppable?: DDDroppable;\n  public ddResizable?: DDResizable;\n\n  constructor(public el: DDElementHost) {}\n\n  public on(eventName: string, callback: (event: MouseEvent) => void): DDElement {\n    if (this.ddDraggable && ['drag', 'dragstart', 'dragstop'].indexOf(eventName) > -1) {\n      this.ddDraggable.on(eventName as 'drag' | 'dragstart' | 'dragstop', callback);\n    } else if (this.ddDroppable && ['drop', 'dropover', 'dropout'].indexOf(eventName) > -1) {\n      this.ddDroppable.on(eventName as 'drop' | 'dropover' | 'dropout', callback);\n    } else if (this.ddResizable && ['resizestart', 'resize', 'resizestop'].indexOf(eventName) > -1) {\n      this.ddResizable.on(eventName as 'resizestart' | 'resize' | 'resizestop', callback);\n    }\n    return this;\n  }\n\n  public off(eventName: string): DDElement {\n    if (this.ddDraggable && ['drag', 'dragstart', 'dragstop'].indexOf(eventName) > -1) {\n      this.ddDraggable.off(eventName as 'drag' | 'dragstart' | 'dragstop');\n    } else if (this.ddDroppable && ['drop', 'dropover', 'dropout'].indexOf(eventName) > -1) {\n      this.ddDroppable.off(eventName as 'drop' | 'dropover' | 'dropout');\n    } else if (this.ddResizable && ['resizestart', 'resize', 'resizestop'].indexOf(eventName) > -1) {\n      this.ddResizable.off(eventName as 'resizestart' | 'resize' | 'resizestop');\n    }\n    return this;\n  }\n\n  public setupDraggable(opts: DDDragOpt): DDElement {\n    if (!this.ddDraggable) {\n      this.ddDraggable = new DDDraggable(this.el, opts);\n    } else {\n      this.ddDraggable.updateOption(opts);\n    }\n    return this;\n  }\n\n  public cleanDraggable(): DDElement {\n    if (this.ddDraggable) {\n      this.ddDraggable.destroy();\n      delete this.ddDraggable;\n    }\n    return this;\n  }\n\n  public setupResizable(opts: DDResizableOpt): DDElement {\n    if (!this.ddResizable) {\n      this.ddResizable = new DDResizable(this.el, opts);\n    } else {\n      this.ddResizable.updateOption(opts);\n    }\n    return this;\n  }\n\n  public cleanResizable(): DDElement {\n    if (this.ddResizable) {\n      this.ddResizable.destroy();\n      delete this.ddResizable;\n    }\n    return this;\n  }\n\n  public setupDroppable(opts: DDDroppableOpt): DDElement {\n    if (!this.ddDroppable) {\n      this.ddDroppable = new DDDroppable(this.el, opts);\n    } else {\n      this.ddDroppable.updateOption(opts);\n    }\n    return this;\n  }\n\n  public cleanDroppable(): DDElement {\n    if (this.ddDroppable) {\n      this.ddDroppable.destroy();\n      delete this.ddDroppable;\n    }\n    return this;\n  }\n}\n"
  },
  {
    "path": "src/dd-gridstack.ts",
    "content": "/**\r\n * dd-gridstack.ts 12.4.3\r\n * Copyright (c) 2021-2025 Alain Dumesny - see GridStack root license\r\n */\r\n\r\n/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport { GridItemHTMLElement, GridStackElement, DDDragOpt } from './types';\r\nimport { Utils } from './utils';\r\nimport { DDManager } from './dd-manager';\r\nimport { DDElement, DDElementHost } from './dd-element';\r\nimport { GridHTMLElement } from './gridstack';\r\n\r\n/**\r\n * Drag & Drop options for drop targets.\r\n * Configures which elements can be dropped onto a grid.\r\n */\r\nexport type DDDropOpt = {\r\n  /** Function to determine if an element can be dropped (see GridStackOptions.acceptWidgets) */\r\n  accept?: (el: GridItemHTMLElement) => boolean;\r\n}\r\n\r\n/**\r\n * Drag & Drop operation types used throughout the DD system.\r\n * Can be control commands or configuration objects.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\nexport type DDOpts = 'enable' | 'disable' | 'destroy' | 'option' | string | any;\r\n\r\n/**\r\n * Keys for DD configuration options that can be set via the 'option' command.\r\n */\r\nexport type DDKey = 'minWidth' | 'minHeight' | 'maxWidth' | 'maxHeight' | 'maxHeightMoveUp' | 'maxWidthMoveLeft';\r\n\r\n/**\r\n * Values for DD configuration options (numbers or strings with units).\r\n */\r\nexport type DDValue = number | string;\r\n\r\n/**\r\n * Callback function type for drag & drop events.\r\n *\r\n * @param event - The DOM event that triggered the callback\r\n * @param arg2 - The grid item element being dragged/dropped\r\n * @param helper - Optional helper element used during drag operations\r\n */\r\nexport type DDCallback = (event: Event, arg2: GridItemHTMLElement, helper?: GridItemHTMLElement) => void;\r\n\r\n// let count = 0; // TEST\r\n\r\n/**\r\n * HTML Native Mouse and Touch Events Drag and Drop functionality.\r\n *\r\n * This class provides the main drag & drop implementation for GridStack,\r\n * handling resizing, dragging, and dropping of grid items using native HTML5 events.\r\n * It manages the interaction between different DD components and the grid system.\r\n */\r\nexport class DDGridStack {\r\n\r\n  /**\r\n   * Enable/disable/configure resizing for grid elements.\r\n   *\r\n   * @param el - Grid item element(s) to configure\r\n   * @param opts - Resize options or command ('enable', 'disable', 'destroy', 'option', or config object)\r\n   * @param key - Option key when using 'option' command\r\n   * @param value - Option value when using 'option' command\r\n   * @returns this instance for chaining\r\n   *\r\n   * @example\r\n   * dd.resizable(element, 'enable');  // Enable resizing\r\n   * dd.resizable(element, 'option', 'minWidth', 100);  // Set minimum width\r\n   */\r\n  public resizable(el: GridItemHTMLElement, opts: DDOpts, key?: DDKey, value?: DDValue): DDGridStack {\r\n    this._getDDElements(el, opts).forEach(dEl => {\r\n      if (opts === 'disable' || opts === 'enable') {\r\n        dEl.ddResizable && dEl.ddResizable[opts](); // can't create DD as it requires options for setupResizable()\r\n      } else if (opts === 'destroy') {\r\n        dEl.ddResizable && dEl.cleanResizable();\r\n      } else if (opts === 'option') {\r\n        dEl.setupResizable({ [key]: value });\r\n      } else {\r\n        const n = dEl.el.gridstackNode;\r\n        const grid = n.grid;\r\n        let handles = dEl.el.getAttribute('gs-resize-handles') || grid.opts.resizable.handles || 'e,s,se';\r\n        if (handles === 'all') handles = 'n,e,s,w,se,sw,ne,nw';\r\n        // NOTE: keep the resize handles as e,w don't have enough space (10px) to show resize corners anyway. limit during drag instead\r\n        // restrict vertical resize if height is done to match content anyway... odd to have it spring back\r\n        // if (Utils.shouldSizeToContent(n, true)) {\r\n        //   const doE = handles.indexOf('e') !== -1;\r\n        //   const doW = handles.indexOf('w') !== -1;\r\n        //   handles = doE ? (doW ? 'e,w' : 'e') : (doW ? 'w' : '');\r\n        // }\r\n        const autoHide = !grid.opts.alwaysShowResizeHandle;\r\n        dEl.setupResizable({\r\n          ...grid.opts.resizable,\r\n          ...{ handles, autoHide },\r\n          ...{\r\n            start: opts.start,\r\n            stop: opts.stop,\r\n            resize: opts.resize\r\n          }\r\n        });\r\n      }\r\n    });\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * Enable/disable/configure dragging for grid elements.\r\n   *\r\n   * @param el - Grid item element(s) to configure\r\n   * @param opts - Drag options or command ('enable', 'disable', 'destroy', 'option', or config object)\r\n   * @param key - Option key when using 'option' command\r\n   * @param value - Option value when using 'option' command\r\n   * @returns this instance for chaining\r\n   *\r\n   * @example\r\n   * dd.draggable(element, 'enable');  // Enable dragging\r\n   * dd.draggable(element, {handle: '.drag-handle'});  // Configure drag handle\r\n   */\r\n  public draggable(el: GridItemHTMLElement, opts: DDOpts, key?: DDKey, value?: DDValue): DDGridStack {\r\n    this._getDDElements(el, opts).forEach(dEl => {\r\n      if (opts === 'disable' || opts === 'enable') {\r\n        dEl.ddDraggable && dEl.ddDraggable[opts](); // can't create DD as it requires options for setupDraggable()\r\n      } else if (opts === 'destroy') {\r\n        dEl.ddDraggable && dEl.cleanDraggable();\r\n      } else if (opts === 'option') {\r\n        dEl.setupDraggable({ [key]: value });\r\n      } else {\r\n        const grid = dEl.el.gridstackNode.grid;\r\n        dEl.setupDraggable({\r\n          ...grid.opts.draggable,\r\n          ...{\r\n            // containment: (grid.parentGridNode && grid.opts.dragOut === false) ? grid.el.parentElement : (grid.opts.draggable.containment || null),\r\n            start: opts.start,\r\n            stop: opts.stop,\r\n            drag: opts.drag\r\n          }\r\n        });\r\n      }\r\n    });\r\n    return this;\r\n  }\r\n\r\n  public dragIn(el: GridStackElement, opts: DDDragOpt): DDGridStack {\r\n    this._getDDElements(el).forEach(dEl => dEl.setupDraggable(opts));\r\n    return this;\r\n  }\r\n\r\n  public droppable(el: GridItemHTMLElement, opts: DDOpts | DDDropOpt, key?: DDKey, value?: DDValue): DDGridStack {\r\n    if (typeof opts.accept === 'function' && !opts._accept) {\r\n      opts._accept = opts.accept;\r\n      opts.accept = (el) => opts._accept(el);\r\n    }\r\n    this._getDDElements(el, opts).forEach(dEl => {\r\n      if (opts === 'disable' || opts === 'enable') {\r\n        dEl.ddDroppable && dEl.ddDroppable[opts]();\r\n      } else if (opts === 'destroy') {\r\n        dEl.ddDroppable && dEl.cleanDroppable();\r\n      } else if (opts === 'option') {\r\n        dEl.setupDroppable({ [key]: value });\r\n      } else {\r\n        dEl.setupDroppable(opts);\r\n      }\r\n    });\r\n    return this;\r\n  }\r\n\r\n  /** true if element is droppable */\r\n  public isDroppable(el: DDElementHost): boolean {\r\n    return !!(el?.ddElement?.ddDroppable && !el.ddElement.ddDroppable.disabled);\r\n  }\r\n\r\n  /** true if element is draggable */\r\n  public isDraggable(el: DDElementHost): boolean {\r\n    return !!(el?.ddElement?.ddDraggable && !el.ddElement.ddDraggable.disabled);\r\n  }\r\n\r\n  /** true if element is draggable */\r\n  public isResizable(el: DDElementHost): boolean {\r\n    return !!(el?.ddElement?.ddResizable && !el.ddElement.ddResizable.disabled);\r\n  }\r\n\r\n  public on(el: GridItemHTMLElement, name: string, callback: DDCallback): DDGridStack {\r\n    this._getDDElements(el).forEach(dEl =>\r\n      dEl.on(name, (event: Event) => {\r\n        callback(\r\n          event,\r\n          DDManager.dragElement ? DDManager.dragElement.el : event.target as GridItemHTMLElement,\r\n          DDManager.dragElement ? DDManager.dragElement.helper : null)\r\n      })\r\n    );\r\n    return this;\r\n  }\r\n\r\n  public off(el: GridItemHTMLElement, name: string): DDGridStack {\r\n    this._getDDElements(el).forEach(dEl => dEl.off(name));\r\n    return this;\r\n  }\r\n\r\n  /** @internal returns a list of DD elements, creating them on the fly by default unless option is to destroy or disable */\r\n  protected _getDDElements(els: GridStackElement, opts?: DDOpts): DDElement[] {\r\n    // don't force create if we're going to destroy it, unless it's a grid which is used as drop target for it's children\r\n    const create = (els as GridHTMLElement).gridstack ||  opts !== 'destroy' && opts !== 'disable';\r\n    const hosts = Utils.getElements(els) as DDElementHost[];\r\n    if (!hosts.length) return [];\r\n    const list = hosts.map(e => e.ddElement || (create ? DDElement.init(e) : null)).filter(d => d); // remove nulls\r\n    return list;\r\n  }\r\n}\r\n"
  },
  {
    "path": "src/dd-manager.ts",
    "content": "/**\n * dd-manager.ts 12.4.3\n * Copyright (c) 2021-2025 Alain Dumesny - see GridStack root license\n */\n\nimport { DDDraggable } from './dd-draggable';\nimport { DDDroppable } from './dd-droppable';\nimport { DDResizable } from './dd-resizable';\n\n/**\n * Global state manager for all Drag & Drop instances.\n *\n * This class maintains shared state across all drag & drop operations,\n * ensuring proper coordination between multiple grids and drag/drop elements.\n * All properties are static to provide global access throughout the DD system.\n */\nexport class DDManager {\n  /**\n   * Controls drag operation pausing behavior.\n   * If set to true or a number (milliseconds), dragging placement and collision\n   * detection will only happen after the user pauses movement.\n   * This improves performance during rapid mouse movements.\n   */\n  public static pauseDrag: boolean | number;\n\n  /**\n   * Flag indicating if a mouse down event was already handled.\n   * Prevents multiple handlers from processing the same mouse event.\n   */\n  public static mouseHandled: boolean;\n\n  /**\n   * Reference to the element currently being dragged.\n   * Used to track the active drag operation across the system.\n   */\n  public static dragElement: DDDraggable;\n\n  /**\n   * Reference to the drop target element currently under the cursor.\n   * Used to handle drop operations and hover effects.\n   */\n  public static dropElement: DDDroppable;\n\n  /**\n   * Reference to the element currently being resized.\n   * Helps ignore nested grid resize handles during resize operations.\n   */\n  public static overResizeElement: DDResizable;\n\n}\n"
  },
  {
    "path": "src/dd-resizable-handle.ts",
    "content": "/**\n * dd-resizable-handle.ts 12.4.3\n * Copyright (c) 2021-2025  Alain Dumesny - see GridStack root license\n */\n\nimport { isTouch, pointerdown, touchend, touchmove, touchstart } from './dd-touch';\nimport { GridItemHTMLElement } from './gridstack';\n\nexport interface DDResizableHandleOpt {\n  element?: string | HTMLElement;\n  start?: (event: MouseEvent) => void;\n  move?: (event: MouseEvent) => void;\n  stop?: (event: MouseEvent) => void;\n}\n\nexport class DDResizableHandle {\n  /** @internal */\n  protected el: HTMLElement;\n  /** @internal true after we've moved enough pixels to start a resize */\n  protected moving = false;\n  /** @internal */\n  protected mouseDownEvent: MouseEvent;\n  /** @internal */\n  protected static prefix = 'ui-resizable-';\n\n  constructor(protected host: GridItemHTMLElement, protected dir: string, protected option: DDResizableHandleOpt) {\n    // create var event binding so we can easily remove and still look like TS methods (unlike anonymous functions)\n    this._mouseDown = this._mouseDown.bind(this);\n    this._mouseMove = this._mouseMove.bind(this);\n    this._mouseUp = this._mouseUp.bind(this);\n    this._keyEvent = this._keyEvent.bind(this);\n\n    this._init();\n  }\n\n  /** @internal */\n  protected _init(): DDResizableHandle {\n    if (this.option.element) {\n      try {\n        this.el = this.option.element instanceof HTMLElement\n          ? this.option.element\n          : this.host.querySelector(this.option.element)\n      } catch (error) {\n        this.option.element = undefined // make sure destroy handles it correctly\n        console.error(\"Query for resizeable handle failed, falling back\", error)\n      }\n    }\n\n    if (!this.el) {\n      this.el = document.createElement('div');\n      this.host.appendChild(this.el);\n    }\n\n    this.el.classList.add('ui-resizable-handle');\n    this.el.classList.add(`${DDResizableHandle.prefix}${this.dir}`);\n    this.el.style.zIndex = '100';\n    this.el.style.userSelect = 'none';\n\n    this.el.addEventListener('mousedown', this._mouseDown);\n    if (isTouch) {\n      this.el.addEventListener('touchstart', touchstart);\n      this.el.addEventListener('pointerdown', pointerdown);\n      // this.el.style.touchAction = 'none'; // not needed unlike pointerdown doc comment\n    }\n\n    return this;\n  }\n\n  /** call this when resize handle needs to be removed and cleaned up */\n  public destroy(): DDResizableHandle {\n    if (this.moving) this._mouseUp(this.mouseDownEvent);\n    this.el.removeEventListener('mousedown', this._mouseDown);\n    if (isTouch) {\n      this.el.removeEventListener('touchstart', touchstart);\n      this.el.removeEventListener('pointerdown', pointerdown);\n    }\n    if (!this.option.element) {\n      this.host.removeChild(this.el);\n    }\n    delete this.el;\n    delete this.host;\n    return this;\n  }\n\n  /** @internal called on mouse down on us: capture move on the entire document (mouse might not stay on us) until we release the mouse */\n  protected _mouseDown(e: MouseEvent): void {\n    this.mouseDownEvent = e;\n    document.addEventListener('mousemove', this._mouseMove, { capture: true, passive: true}); // capture, not bubble\n    document.addEventListener('mouseup', this._mouseUp, true);\n    if (isTouch) {\n      this.el.addEventListener('touchmove', touchmove);\n      this.el.addEventListener('touchend', touchend);\n    }\n    e.stopPropagation();\n    e.preventDefault();\n  }\n\n  /** @internal */\n  protected _mouseMove(e: MouseEvent): void {\n    const s = this.mouseDownEvent;\n    if (this.moving) {\n      this._triggerEvent('move', e);\n    } else if (Math.abs(e.x - s.x) + Math.abs(e.y - s.y) > 2) {\n      // don't start unless we've moved at least 3 pixels\n      this.moving = true;\n      this._triggerEvent('start', this.mouseDownEvent);\n      this._triggerEvent('move', e);\n      // now track keyboard events to cancel\n      document.addEventListener('keydown', this._keyEvent);\n    }\n    e.stopPropagation();\n    // e.preventDefault(); passive = true\n  }\n\n  /** @internal */\n  protected _mouseUp(e: MouseEvent): void {\n    if (this.moving) {\n      this._triggerEvent('stop', e);\n      document.removeEventListener('keydown', this._keyEvent);\n    }\n    document.removeEventListener('mousemove', this._mouseMove, true);\n    document.removeEventListener('mouseup', this._mouseUp, true);\n    if (isTouch) {\n      this.el.removeEventListener('touchmove', touchmove);\n      this.el.removeEventListener('touchend', touchend);\n    }\n    delete this.moving;\n    delete this.mouseDownEvent;\n    e.stopPropagation();\n    e.preventDefault();\n  }\n\n  /** @internal call when keys are being pressed - use Esc to cancel */\n  protected _keyEvent(e: KeyboardEvent): void {\n    if (e.key === 'Escape') {\n      this.host.gridstackNode?.grid?.engine.restoreInitial();\n      this._mouseUp(this.mouseDownEvent);\n    }\n  }\n\n\n\n  /** @internal */\n  protected _triggerEvent(name: string, event: MouseEvent): DDResizableHandle {\n    if (this.option[name]) this.option[name](event);\n    return this;\n  }\n}\n"
  },
  {
    "path": "src/dd-resizable.ts",
    "content": "/**\n * dd-resizable.ts 12.4.3\n * Copyright (c) 2021-2025  Alain Dumesny - see GridStack root license\n */\n\nimport { DDResizableHandle } from './dd-resizable-handle';\nimport { DDBaseImplement, HTMLElementExtendOpt } from './dd-base-impl';\nimport { Utils } from './utils';\nimport { DDResizeOpt, DDUIData, GridItemHTMLElement, GridStackMouseEvent, Rect, Size } from './types';\nimport { DDManager } from './dd-manager';\n\n// import { GridItemHTMLElement } from './types'; let count = 0; // TEST\n\n// TODO: merge with DDDragOpt\nexport interface DDResizableOpt extends DDResizeOpt {\n  maxHeight?: number;\n  maxHeightMoveUp?: number;\n  maxWidth?: number;\n  maxWidthMoveLeft?: number;\n  minHeight?: number;\n  minWidth?: number;\n  start?: (event: Event, ui: DDUIData) => void;\n  stop?: (event: Event) => void;\n  resize?: (event: Event, ui: DDUIData) => void;\n}\n\ninterface RectScaleReciprocal {\n  x: number;\n  y: number;\n}\n\nexport class DDResizable extends DDBaseImplement implements HTMLElementExtendOpt<DDResizableOpt> {\n  /** @internal */\n  protected handlers: DDResizableHandle[];\n  /** @internal */\n  protected originalRect: Rect;\n  /** @internal */\n  protected rectScale: RectScaleReciprocal = { x: 1, y: 1 };\n  /** @internal */\n  protected temporalRect: Rect;\n  /** @internal */\n  protected scrollY: number;\n  /** @internal */\n  protected scrolled: number;\n  /** @internal */\n  protected scrollEl: HTMLElement;\n  /** @internal */\n  protected startEvent: MouseEvent;\n  /** @internal value saved in the same order as _originStyleProp[] */\n  protected elOriginStyleVal: string[];\n  /** @internal */\n  protected parentOriginStylePosition: string;\n  /** @internal */\n  protected static _originStyleProp = ['width', 'height', 'position', 'left', 'top', 'opacity', 'zIndex'];\n  /** @internal */\n  protected sizeToContent: boolean;\n\n  // have to be public else complains for HTMLElementExtendOpt ?\n  constructor(public el: GridItemHTMLElement, public option: DDResizableOpt = {}) {\n    super();\n    // create var event binding so we can easily remove and still look like TS methods (unlike anonymous functions)\n    this._mouseOver = this._mouseOver.bind(this);\n    this._mouseOut = this._mouseOut.bind(this);\n    this.enable();\n    this._setupAutoHide(this.option.autoHide);\n    this._setupHandlers();\n  }\n\n  public on(event: 'resizestart' | 'resize' | 'resizestop', callback: (event: DragEvent) => void): void {\n    super.on(event, callback);\n  }\n\n  public off(event: 'resizestart' | 'resize' | 'resizestop'): void {\n    super.off(event);\n  }\n\n  public enable(): void {\n    super.enable();\n    this.el.classList.remove('ui-resizable-disabled');\n    this._setupAutoHide(this.option.autoHide);\n  }\n\n  public disable(): void {\n    super.disable();\n    this.el.classList.add('ui-resizable-disabled');\n    this._setupAutoHide(false);\n  }\n\n  public destroy(): void {\n    this._removeHandlers();\n    this._setupAutoHide(false);\n    delete this.el;\n    super.destroy();\n  }\n\n  public updateOption(opts: DDResizableOpt): DDResizable {\n    const updateHandles = (opts.handles && opts.handles !== this.option.handles);\n    const updateAutoHide = (opts.autoHide && opts.autoHide !== this.option.autoHide);\n    Object.keys(opts).forEach(key => this.option[key] = opts[key]);\n    if (updateHandles) {\n      this._removeHandlers();\n      this._setupHandlers();\n    }\n    if (updateAutoHide) {\n      this._setupAutoHide(this.option.autoHide);\n    }\n    return this;\n  }\n\n  /** @internal turns auto hide on/off */\n  protected _setupAutoHide(auto: boolean): DDResizable {\n    if (auto) {\n      this.el.classList.add('ui-resizable-autohide');\n      // use mouseover and not mouseenter to get better performance and track for nested cases\n      this.el.addEventListener('mouseover', this._mouseOver);\n      this.el.addEventListener('mouseout', this._mouseOut);\n    } else {\n      this.el.classList.remove('ui-resizable-autohide');\n      this.el.removeEventListener('mouseover', this._mouseOver);\n      this.el.removeEventListener('mouseout', this._mouseOut);\n      if (DDManager.overResizeElement === this) {\n        delete DDManager.overResizeElement;\n      }\n    }\n    return this;\n  }\n\n  /** @internal */\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  protected _mouseOver(e: Event): void {\n    // console.log(`${count++} pre-enter ${(this.el as GridItemHTMLElement).gridstackNode._id}`)\n    // already over a child, ignore. Ideally we just call e.stopPropagation() but see https://github.com/gridstack/gridstack.js/issues/2018\n    if (DDManager.overResizeElement || DDManager.dragElement) return;\n    DDManager.overResizeElement = this;\n    // console.log(`${count++} enter ${(this.el as GridItemHTMLElement).gridstackNode._id}`)\n    this.el.classList.remove('ui-resizable-autohide');\n  }\n\n  /** @internal */\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  protected _mouseOut(e: Event): void {\n    // console.log(`${count++} pre-leave ${(this.el as GridItemHTMLElement).gridstackNode._id}`)\n    if (DDManager.overResizeElement !== this) return;\n    delete DDManager.overResizeElement;\n    // console.log(`${count++} leave ${(this.el as GridItemHTMLElement).gridstackNode._id}`)\n    this.el.classList.add('ui-resizable-autohide');\n  }\n\n  /** @internal */\n  protected _setupHandlers(): DDResizable {\n    this.handlers = this.option.handles.split(',')\n      .map(dir => dir.trim())\n      .map(dir => new DDResizableHandle(this.el, dir, {\n        element: this.option.element,\n        start: (event: MouseEvent) => this._resizeStart(event),\n        stop: (event: MouseEvent) => this._resizeStop(event),\n        move: (event: MouseEvent) => this._resizing(event, dir)\n      }));\n    return this;\n  }\n\n  /** @internal */\n  protected _resizeStart(event: MouseEvent): DDResizable {\n    this.sizeToContent = Utils.shouldSizeToContent(this.el.gridstackNode, true); // strick true only and not number\n    this.originalRect = this.el.getBoundingClientRect();\n    this.scrollEl = Utils.getScrollElement(this.el);\n    this.scrollY = this.scrollEl.scrollTop;\n    this.scrolled = 0;\n    this.startEvent = event;\n    this._setupHelper();\n    this._applyChange();\n    const ev = Utils.initEvent<MouseEvent>(event, { type: 'resizestart', target: this.el });\n    if (this.option.start) {\n      this.option.start(ev, this._ui());\n    }\n    this.el.classList.add('ui-resizable-resizing');\n    this.triggerEvent('resizestart', ev);\n    return this;\n  }\n\n  /** @internal */\n  protected _resizing(event: MouseEvent, dir: string): DDResizable {\n    this.scrolled = this.scrollEl.scrollTop - this.scrollY;\n    this.temporalRect = this._getChange(event, dir);\n    this._applyChange();\n    const ev = Utils.initEvent<GridStackMouseEvent>(event, { type: 'resize', target: this.el });\n    ev.resizeDir = dir; // expose handle direction so _dragOrResize can avoid position drift\n    if (this.option.resize) {\n      this.option.resize(ev, this._ui());\n    }\n    this.triggerEvent('resize', ev);\n    return this;\n  }\n\n  /** @internal */\n  protected _resizeStop(event: MouseEvent): DDResizable {\n    const ev = Utils.initEvent<MouseEvent>(event, { type: 'resizestop', target: this.el });\n    // Remove style attr now, so the stop handler can rebuild style attrs\n    this._cleanHelper();\n    if (this.option.stop) {\n      this.option.stop(ev); // Note: ui() not used by gridstack so don't pass\n    }\n    this.el.classList.remove('ui-resizable-resizing');\n    this.triggerEvent('resizestop', ev);\n    delete this.startEvent;\n    delete this.originalRect;\n    delete this.temporalRect;\n    delete this.scrollY;\n    delete this.scrolled;\n    return this;\n  }\n\n  /** @internal */\n  protected _setupHelper(): DDResizable {\n    this.elOriginStyleVal = DDResizable._originStyleProp.map(prop => this.el.style[prop]);\n    this.parentOriginStylePosition = this.el.parentElement.style.position;\n\n    const parent = this.el.parentElement;\n    const dragTransform = Utils.getValuesFromTransformedElement(parent);\n    this.rectScale = {\n      x: dragTransform.xScale,\n      y: dragTransform.yScale\n    };\n\n    if (getComputedStyle(this.el.parentElement).position.match(/static/)) {\n      this.el.parentElement.style.position = 'relative';\n    }\n    this.el.style.position = 'absolute';\n    this.el.style.opacity = '0.8';\n    return this;\n  }\n\n  /** @internal */\n  protected _cleanHelper(): DDResizable {\n    DDResizable._originStyleProp.forEach((prop, i) => {\n      this.el.style[prop] = this.elOriginStyleVal[i] || null;\n    });\n    this.el.parentElement.style.position = this.parentOriginStylePosition || null;\n    return this;\n  }\n\n  /** @internal */\n  protected _getChange(event: MouseEvent, dir: string): Rect {\n    const oEvent = this.startEvent;\n    const newRect = { // Note: originalRect is a complex object, not a simple Rect, so copy out.\n      width: this.originalRect.width,\n      height: this.originalRect.height + this.scrolled,\n      left: this.originalRect.left,\n      top: this.originalRect.top - this.scrolled\n    };\n\n    const offsetX = event.clientX - oEvent.clientX;\n    const offsetY = this.sizeToContent ? 0 : event.clientY - oEvent.clientY; // prevent vert resize\n    let moveLeft: boolean;\n    let moveUp: boolean;\n\n    if (dir.indexOf('e') > -1) {\n      newRect.width += offsetX;\n    } else if (dir.indexOf('w') > -1) {\n      newRect.width -= offsetX;\n      newRect.left += offsetX;\n      moveLeft = true;\n    }\n    if (dir.indexOf('s') > -1) {\n      newRect.height += offsetY;\n    } else if (dir.indexOf('n') > -1) {\n      newRect.height -= offsetY;\n      newRect.top += offsetY\n      moveUp = true;\n    }\n    const constrain = this._constrainSize(newRect.width, newRect.height, moveLeft, moveUp);\n    if (Math.round(newRect.width) !== Math.round(constrain.width)) { // round to ignore slight round-off errors\n      if (dir.indexOf('w') > -1) {\n        newRect.left += newRect.width - constrain.width;\n      }\n      newRect.width = constrain.width;\n    }\n    if (Math.round(newRect.height) !== Math.round(constrain.height)) {\n      if (dir.indexOf('n') > -1) {\n        newRect.top += newRect.height - constrain.height;\n      }\n      newRect.height = constrain.height;\n    }\n    return newRect;\n  }\n\n  /** @internal constrain the size to the set min/max values */\n  protected _constrainSize(oWidth: number, oHeight: number, moveLeft: boolean, moveUp: boolean): Size {\n    const o = this.option;\n    const maxWidth = (moveLeft ? o.maxWidthMoveLeft : o.maxWidth) || Number.MAX_SAFE_INTEGER;\n    const minWidth = o.minWidth / this.rectScale.x || oWidth;\n    const maxHeight = (moveUp ? o.maxHeightMoveUp : o.maxHeight) || Number.MAX_SAFE_INTEGER;\n    const minHeight = o.minHeight / this.rectScale.y || oHeight;\n    const width = Math.min(maxWidth, Math.max(minWidth, oWidth));\n    const height = Math.min(maxHeight, Math.max(minHeight, oHeight));\n    return { width, height };\n  }\n\n  /** @internal */\n  protected _applyChange(): DDResizable {\n    let containmentRect = { left: 0, top: 0, width: 0, height: 0 };\n    if (this.el.style.position === 'absolute') {\n      const containmentEl = this.el.parentElement;\n      const { left, top } = containmentEl.getBoundingClientRect();\n      containmentRect = { left, top, width: 0, height: 0 };\n    }\n    if (!this.temporalRect) return this;\n    Object.keys(this.temporalRect).forEach(key => {\n      const value = this.temporalRect[key];\n      const scaleReciprocal = key === 'width' || key === 'left' ? this.rectScale.x : key === 'height' || key === 'top' ? this.rectScale.y : 1;\n      this.el.style[key] = (value - containmentRect[key]) * scaleReciprocal + 'px';\n    });\n    return this;\n  }\n\n  /** @internal */\n  protected _removeHandlers(): DDResizable {\n    this.handlers.forEach(handle => handle.destroy());\n    delete this.handlers;\n    return this;\n  }\n\n  /** @internal */\n  protected _ui = (): DDUIData => {\n    const containmentEl = this.el.parentElement;\n    const containmentRect = containmentEl.getBoundingClientRect();\n    const newRect = { // Note: originalRect is a complex object, not a simple Rect, so copy out.\n      width: this.originalRect.width,\n      height: this.originalRect.height + this.scrolled,\n      left: this.originalRect.left,\n      top: this.originalRect.top - this.scrolled\n    };\n    const rect = this.temporalRect || newRect;\n    return {\n      position: {\n        left: (rect.left - containmentRect.left) * this.rectScale.x,\n        top: (rect.top - containmentRect.top) * this.rectScale.y\n      },\n      size: {\n        width: rect.width * this.rectScale.x,\n        height: rect.height * this.rectScale.y\n      }\n      /* Gridstack ONLY needs position set above... keep around in case.\n      element: [this.el], // The object representing the element to be resized\n      helper: [], // TODO: not support yet - The object representing the helper that's being resized\n      originalElement: [this.el],// we don't wrap here, so simplify as this.el //The object representing the original element before it is wrapped\n      originalPosition: { // The position represented as { left, top } before the resizable is resized\n        left: this.originalRect.left - containmentRect.left,\n        top: this.originalRect.top - containmentRect.top\n      },\n      originalSize: { // The size represented as { width, height } before the resizable is resized\n        width: this.originalRect.width,\n        height: this.originalRect.height\n      }\n      */\n    };\n  }\n}\n"
  },
  {
    "path": "src/dd-touch.ts",
    "content": "/**\n * touch.ts 12.4.3\n * Copyright (c) 2021-2025 Alain Dumesny - see GridStack root license\n */\n\nimport { DDManager } from './dd-manager';\nimport { Utils } from './utils';\n\n/**\n * Detect touch support - Windows Surface devices and other touch devices\n * should we use this instead ? (what we had for always showing resize handles)\n * /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)\n */\nexport const isTouch: boolean = typeof window !== 'undefined' && typeof document !== 'undefined' &&\n  ( 'ontouchstart' in document\n    || 'ontouchstart' in window\n    // || !!window.TouchEvent // true on Windows 10 Chrome desktop so don't use this\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n    || ((window as any).DocumentTouch && document instanceof (window as any).DocumentTouch)\n    || navigator.maxTouchPoints > 0\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n    || (navigator as any).msMaxTouchPoints > 0\n  );\n\n// interface TouchCoord {x: number, y: number};\n\nexport class DDTouch {\n  /** set to true while we are handling touch dragging, to prevent accepting browser real mouse events (trusted:true) vs our simulated ones (trusted:false) */\n  public static touchHandled: boolean;\n  public static pointerLeaveTimeout: number;\n}\n\n/**\n* Get the x,y position of a touch event\n*/\n// function getTouchCoords(e: TouchEvent): TouchCoord {\n//   return {\n//     x: e.changedTouches[0].pageX,\n//     y: e.changedTouches[0].pageY\n//   };\n// }\n\n/**\n * Simulate a mouse event based on a corresponding touch event\n * @param {Object} e A touch event\n * @param {String} simulatedType The corresponding mouse event\n */\nfunction simulateMouseEvent(e: TouchEvent, simulatedType: string) {\n\n  // Ignore multi-touch events\n  if (e.touches.length > 1) return;\n\n  // Prevent \"Ignored attempt to cancel a touchmove event with cancelable=false\" errors\n  if (e.cancelable) e.preventDefault();\n\n  // Dispatch the simulated event to the target element\n  Utils.simulateMouseEvent(e.changedTouches[0], simulatedType);\n}\n\n/**\n * Simulate a mouse event based on a corresponding Pointer event\n * @param {Object} e A pointer event\n * @param {String} simulatedType The corresponding mouse event\n */\nfunction simulatePointerMouseEvent(e: PointerEvent, simulatedType: string) {\n\n  // Prevent \"Ignored attempt to cancel a touchmove event with cancelable=false\" errors\n  if (e.cancelable) e.preventDefault();\n\n  // Dispatch the simulated event to the target element\n  Utils.simulateMouseEvent(e, simulatedType);\n}\n\n\n/**\n * Handle the touchstart events\n * @param {Object} e The widget element's touchstart event\n */\nexport function touchstart(e: TouchEvent): void {\n  // Ignore the event if another widget is already being handled\n  if (DDTouch.touchHandled) return;\n  DDTouch.touchHandled = true;\n\n  // Simulate the mouse events\n  // simulateMouseEvent(e, 'mouseover');\n  // simulateMouseEvent(e, 'mousemove');\n  simulateMouseEvent(e, 'mousedown');\n}\n\n/**\n * Handle the touchmove events\n * @param {Object} e The document's touchmove event\n */\nexport function touchmove(e: TouchEvent): void {\n  // Ignore event if not handled by us\n  if (!DDTouch.touchHandled) return;\n\n  simulateMouseEvent(e, 'mousemove');\n}\n\n/**\n * Handle the touchend events\n * @param {Object} e The document's touchend event\n */\nexport function touchend(e: TouchEvent): void {\n\n  // Ignore event if not handled\n  if (!DDTouch.touchHandled) return;\n\n  // cancel delayed leave event when we release on ourself which happens BEFORE we get this!\n  if (DDTouch.pointerLeaveTimeout) {\n    window.clearTimeout(DDTouch.pointerLeaveTimeout);\n    delete DDTouch.pointerLeaveTimeout;\n  }\n\n  const wasDragging = !!DDManager.dragElement;\n\n  // Simulate the mouseup event\n  simulateMouseEvent(e, 'mouseup');\n  // simulateMouseEvent(event, 'mouseout');\n\n  // If the touch interaction did not move, it should trigger a click\n  if (!wasDragging) {\n    simulateMouseEvent(e, 'click');\n  }\n\n  // Unset the flag to allow other widgets to inherit the touch event\n  DDTouch.touchHandled = false;\n}\n\n/**\n * Note we don't get touchenter/touchleave (which are deprecated)\n * see https://stackoverflow.com/questions/27908339/js-touch-equivalent-for-mouseenter\n * so instead of PointerEvent to still get enter/leave and send the matching mouse event.\n */\nexport function pointerdown(e: PointerEvent): void {\n  // console.log(\"pointer down\")\n  if (e.pointerType === 'mouse') return;\n  (e.target as HTMLElement).releasePointerCapture(e.pointerId) // <- Important!\n}\n\nexport function pointerenter(e: PointerEvent): void {\n  // ignore the initial one we get on pointerdown on ourself\n  if (!DDManager.dragElement) {\n    // console.log('pointerenter ignored');\n    return;\n  }\n  // console.log('pointerenter');\n  if (e.pointerType === 'mouse') return;\n  simulatePointerMouseEvent(e, 'mouseenter');\n}\n\nexport function pointerleave(e: PointerEvent): void {\n  // ignore the leave on ourself we get before releasing the mouse over ourself\n  // by delaying sending the event and having the up event cancel us\n  if (!DDManager.dragElement) {\n    // console.log('pointerleave ignored');\n    return;\n  }\n  if (e.pointerType === 'mouse') return;\n  DDTouch.pointerLeaveTimeout = window.setTimeout(() => {\n    delete DDTouch.pointerLeaveTimeout;\n    // console.log('pointerleave delayed');\n    simulatePointerMouseEvent(e, 'mouseleave');\n  }, 10);\n}\n\n"
  },
  {
    "path": "src/gridstack-engine.ts",
    "content": "/**\n * gridstack-engine.ts 12.4.3\n * Copyright (c) 2021-2025  Alain Dumesny - see GridStack root license\n */\n\nimport { Utils } from './utils';\nimport { GridStackNode, ColumnOptions, GridStackPosition, GridStackMoveOpts, SaveFcn, CompactOptions } from './types';\n\n/** callback to update the DOM attributes since this class is generic (no HTML or other info) for items that changed - see _notify() */\ntype OnChangeCB = (nodes: GridStackNode[]) => void;\n\n/** options used during creation - similar to GridStackOptions */\nexport interface GridStackEngineOptions {\n  column?: number;\n  maxRow?: number;\n  float?: boolean;\n  nodes?: GridStackNode[];\n  onChange?: OnChangeCB;\n}\n\n/**\n * Defines the GridStack engine that handles all grid layout calculations and node positioning.\n * This is the core engine that performs grid manipulation without any DOM operations.\n *\n * The engine manages:\n * - Node positioning and collision detection\n * - Layout algorithms (compact, float, etc.)\n * - Grid resizing and column changes\n * - Widget movement and resizing logic\n *\n * NOTE: Values should not be modified directly - use the main GridStack API instead\n * to ensure proper DOM updates and event triggers.\n */\nexport class GridStackEngine {\n  public column: number;\n  public maxRow: number;\n  public nodes: GridStackNode[];\n  public addedNodes: GridStackNode[] = [];\n  public removedNodes: GridStackNode[] = [];\n  public batchMode: boolean;\n  public defaultColumn = 12;\n  /** @internal callback to update the DOM attributes */\n  protected onChange: OnChangeCB;\n  /** @internal */\n  protected _float: boolean;\n  /** @internal */\n  protected _prevFloat: boolean;\n  /** @internal cached layouts of difference column count so we can restore back (eg 12 -> 1 -> 12) */\n  protected _layouts?: GridStackNode[][]; // maps column # to array of values nodes\n  /** @internal set during loading (which is sorted) so item gets added AFTER collision nodes */\n  public _loading?: boolean\n  /** @internal true while we are resizing widgets during column resize to skip certain parts */\n  protected _inColumnResize?: boolean;\n  /** true when grid.load() already cached the layout and can skip out of bound caching info */\n  public skipCacheUpdate?: boolean;\n  /** @internal true if we have some items locked */\n  protected _hasLocked: boolean;\n  /** @internal unique global internal _id counter */\n  public static _idSeq = 0;\n\n  public constructor(opts: GridStackEngineOptions = {}) {\n    this.column = opts.column || this.defaultColumn;\n    if (this.column > this.defaultColumn) this.defaultColumn = this.column;\n    this.maxRow = opts.maxRow;\n    this._float = opts.float;\n    this.nodes = opts.nodes || [];\n    this.onChange = opts.onChange;\n  }\n\n  /**\n   * Enable/disable batch mode for multiple operations to optimize performance.\n   * When enabled, layout updates are deferred until batch mode is disabled.\n   *\n   * @param flag true to enable batch mode, false to disable and apply changes\n   * @param doPack if true (default), pack/compact nodes when disabling batch mode\n   * @returns the engine instance for chaining\n   *\n   * @example\n   * // Start batch mode for multiple operations\n   * engine.batchUpdate(true);\n   * engine.addNode(node1);\n   * engine.addNode(node2);\n   * engine.batchUpdate(false); // Apply all changes at once\n   */\n  public batchUpdate(flag = true, doPack = true): GridStackEngine {\n    if (!!this.batchMode === flag) return this;\n    this.batchMode = flag;\n    if (flag) {\n      this._prevFloat = this._float;\n      this._float = true; // let things go anywhere for now... will restore and possibly reposition later\n      this.cleanNodes();\n      this.saveInitial(); // since begin update (which is called multiple times) won't do this\n    } else {\n      this._float = this._prevFloat;\n      delete this._prevFloat;\n      if (doPack) this._packNodes();\n      this._notify();\n    }\n    return this;\n  }\n\n  // use entire row for hitting area (will use bottom reverse sorted first) if we not actively moving DOWN and didn't already skip\n  protected _useEntireRowArea(node: GridStackNode, nn: GridStackPosition): boolean {\n    return (!this.float || this.batchMode && !this._prevFloat) && !this._hasLocked && (!node._moving || node._skipDown || nn.y <= node.y);\n  }\n\n  /** @internal fix collision on given 'node', going to given new location 'nn', with optional 'collide' node already found.\n   * return true if we moved. */\n  protected _fixCollisions(node: GridStackNode, nn = node, collide?: GridStackNode, opt: GridStackMoveOpts = {}): boolean {\n    this.sortNodes(-1); // from last to first, so recursive collision move items in the right order\n\n    collide = collide || this.collide(node, nn); // REAL area collide for swap and skip if none...\n    if (!collide) return false;\n\n    // swap check: if we're actively moving in gravity mode, see if we collide with an object the same size\n    if (node._moving && !opt.nested && !this.float) {\n      if (this.swap(node, collide)) return true;\n    }\n\n    // during while() collisions MAKE SURE to check entire row so larger items don't leap frog small ones (push them all down starting last in grid)\n    let area = nn;\n    if (!this._loading && this._useEntireRowArea(node, nn)) {\n      area = {x: 0, w: this.column, y: nn.y, h: nn.h};\n      collide = this.collide(node, area, opt.skip); // force new hit\n    }\n\n    let didMove = false;\n    const newOpt: GridStackMoveOpts = {nested: true, pack: false};\n    let counter = 0;\n    while (collide = collide || this.collide(node, area, opt.skip)) { // could collide with more than 1 item... so repeat for each\n      if (counter++ > this.nodes.length * 2) {\n        throw new Error(\"Infinite collide check\");\n      }\n      let moved: boolean;\n      // if colliding with a locked item OR loading (move after) OR moving down with top gravity (and collide could move up) -> skip past the collide,\n      // but remember that skip down so we only do this once (and push others otherwise).\n      if (collide.locked || this._loading || node._moving && !node._skipDown && nn.y > node.y && !this.float &&\n        // can take space we had, or before where we're going\n        (!this.collide(collide, {...collide, y: node.y}, node) || !this.collide(collide, {...collide, y: nn.y - collide.h}, node))) {\n\n        node._skipDown = (node._skipDown || nn.y > node.y);\n        const newNN = {...nn, y: collide.y + collide.h, ...newOpt};\n        // pretent we moved to where we are now so we can continue any collision checks #2492\n        moved = this._loading && Utils.samePos(node, newNN) ? true : this.moveNode(node, newNN);\n\n        if ((collide.locked || this._loading) && moved) {\n          Utils.copyPos(nn, node); // moving after lock become our new desired location\n        } else if (!collide.locked && moved && opt.pack) {\n          // we moved after and will pack: do it now and keep the original drop location, but past the old collide to see what else we might push way\n          this._packNodes();\n          nn.y = collide.y + collide.h;\n          Utils.copyPos(node, nn);\n        }\n        didMove = didMove || moved;\n      } else {\n        // move collide down *after* where we will be, ignoring where we are now (don't collide with us)\n        moved = this.moveNode(collide, {...collide, y: nn.y + nn.h, skip: node, ...newOpt});\n      }\n\n      if (!moved) return didMove; // break inf loop if we couldn't move after all (ex: maxRow, fixed)\n\n      collide = undefined;\n    }\n    return didMove;\n  }\n\n  /**\n   * Return the first node that intercepts/collides with the given node or area.\n   * Used for collision detection during drag and drop operations.\n   *\n   * @param skip the node to skip in collision detection (usually the node being moved)\n   * @param area the area to check for collisions (defaults to skip node's area)\n   * @param skip2 optional second node to skip in collision detection\n   * @returns the first colliding node, or undefined if no collision\n   *\n   * @example\n   * const colliding = engine.collide(draggedNode, {x: 2, y: 1, w: 2, h: 1});\n   * if (colliding) {\n   *   console.log('Would collide with:', colliding.id);\n   * }\n   */\n  public collide(skip: GridStackNode, area = skip, skip2?: GridStackNode): GridStackNode | undefined {\n    const skipId = skip._id;\n    const skip2Id = skip2?._id;\n    return this.nodes.find(n => n._id !== skipId && n._id !== skip2Id && Utils.isIntercepted(n, area));\n  }\n  /**\n   * Return all nodes that intercept/collide with the given node or area.\n   * Similar to collide() but returns all colliding nodes instead of just the first.\n   *\n   * @param skip the node to skip in collision detection\n   * @param area the area to check for collisions (defaults to skip node's area)\n   * @param skip2 optional second node to skip in collision detection\n   * @returns array of all colliding nodes\n   *\n   * @example\n   * const allCollisions = engine.collideAll(draggedNode);\n   * console.log('Colliding with', allCollisions.length, 'nodes');\n   */\n  public collideAll(skip: GridStackNode, area = skip, skip2?: GridStackNode): GridStackNode[] {\n    const skipId = skip._id;\n    const skip2Id = skip2?._id;\n    return this.nodes.filter(n => n._id !== skipId && n._id !== skip2Id && Utils.isIntercepted(n, area));\n  }\n\n  /** does a pixel coverage collision based on where we started, returning the node that has the most coverage that is >50% mid line */\n  protected directionCollideCoverage(node: GridStackNode, o: GridStackMoveOpts, collides: GridStackNode[]): GridStackNode | undefined {\n    if (!o.rect || !node._rect) return;\n    const r0 = node._rect; // where started\n    const r = {...o.rect}; // where we are\n\n    // update dragged rect to show where it's coming from (above or below, etc...)\n    if (r.y > r0.y) {\n      r.h += r.y - r0.y;\n      r.y = r0.y;\n    } else {\n      r.h += r0.y - r.y;\n    }\n    if (r.x > r0.x) {\n      r.w += r.x - r0.x;\n      r.x = r0.x;\n    } else {\n      r.w += r0.x - r.x;\n    }\n\n    let collide: GridStackNode;\n    let overMax = 0.5; // need >50%\n    for (let n of collides) {\n      if (n.locked || !n._rect) {\n        break;\n      }\n      const r2 = n._rect; // overlapping target\n      let yOver = Number.MAX_VALUE, xOver = Number.MAX_VALUE;\n      // depending on which side we started from, compute the overlap % of coverage\n      // (ex: from above/below we only compute the max horizontal line coverage)\n      if (r0.y < r2.y) { // from above\n        yOver = ((r.y + r.h) - r2.y) / r2.h;\n      } else if (r0.y + r0.h > r2.y + r2.h) { // from below\n        yOver = ((r2.y + r2.h) - r.y) / r2.h;\n      }\n      if (r0.x < r2.x) { // from the left\n        xOver = ((r.x + r.w) - r2.x) / r2.w;\n      } else if (r0.x + r0.w > r2.x + r2.w) { // from the right\n        xOver = ((r2.x + r2.w) - r.x) / r2.w;\n      }\n      const over = Math.min(xOver, yOver);\n      if (over > overMax) {\n        overMax = over;\n        collide = n;\n      }\n    }\n    o.collide = collide; // save it so we don't have to find it again\n    return collide;\n  }\n\n  /** does a pixel coverage returning the node that has the most coverage by area */\n  /*\n  protected collideCoverage(r: GridStackPosition, collides: GridStackNode[]): {collide: GridStackNode, over: number} {\n    const collide: GridStackNode;\n    const overMax = 0;\n    collides.forEach(n => {\n      if (n.locked || !n._rect) return;\n      const over = Utils.areaIntercept(r, n._rect);\n      if (over > overMax) {\n        overMax = over;\n        collide = n;\n      }\n    });\n    return {collide, over: overMax};\n  }\n  */\n\n  /**\n   * Cache the pixel rectangles for all nodes used for collision detection during drag operations.\n   * This optimization converts grid coordinates to pixel coordinates for faster collision detection.\n   *\n   * @param w width of a single grid cell in pixels\n   * @param h height of a single grid cell in pixels\n   * @param top top margin/padding in pixels\n   * @param right right margin/padding in pixels\n   * @param bottom bottom margin/padding in pixels\n   * @param left left margin/padding in pixels\n   * @returns the engine instance for chaining\n   *\n   * @internal This is typically called by GridStack during resize events\n   */\n  public cacheRects(w: number, h: number, top: number, right: number, bottom: number, left: number): GridStackEngine\n  {\n    this.nodes.forEach(n =>\n      n._rect = {\n        y: n.y * h + top,\n        x: n.x * w + left,\n        w: n.w * w - left - right,\n        h: n.h * h - top - bottom\n      }\n    );\n    return this;\n  }\n\n  /**\n   * Attempt to swap the positions of two nodes if they meet swapping criteria.\n   * Nodes can swap if they are the same size or in the same column/row, not locked, and touching.\n   *\n   * @param a first node to swap\n   * @param b second node to swap\n   * @returns true if swap was successful, false if not possible, undefined if not applicable\n   *\n   * @example\n   * const swapped = engine.swap(nodeA, nodeB);\n   * if (swapped) {\n   *   console.log('Nodes swapped successfully');\n   * }\n   */\n  public swap(a: GridStackNode, b: GridStackNode): boolean | undefined {\n    if (!b || b.locked || !a || a.locked) return false;\n\n    function _doSwap(): true { // assumes a is before b IFF they have different height (put after rather than exact swap)\n      const x = b.x, y = b.y;\n      b.x = a.x; b.y = a.y; // b -> a position\n      if (a.h != b.h) {\n        a.x = x; a.y = b.y + b.h; // a -> goes after b\n      } else if (a.w != b.w) {\n        a.x = b.x + b.w; a.y = y; // a -> goes after b\n      } else {\n        a.x = x; a.y = y; // a -> old b position\n      }\n      a._dirty = b._dirty = true;\n      return true;\n    }\n    let touching: boolean; // remember if we called it (vs undefined)\n\n    // same size and same row or column, and touching\n    if (a.w === b.w && a.h === b.h && (a.x === b.x || a.y === b.y) && (touching = Utils.isTouching(a, b)))\n      return _doSwap();\n    if (touching === false) return; // IFF ran test and fail, bail out\n\n    // check for taking same columns (but different height) and touching\n    if (a.w === b.w && a.x === b.x && (touching || (touching = Utils.isTouching(a, b)))) {\n      if (b.y < a.y) { const t = a; a = b; b = t; } // swap a <-> b vars so a is first\n      return _doSwap();\n    }\n    if (touching === false) return;\n\n    // check if taking same row (but different width) and touching\n    if (a.h === b.h && a.y === b.y && (touching || (touching = Utils.isTouching(a, b)))) {\n      if (b.x < a.x) { const t = a; a = b; b = t; } // swap a <-> b vars so a is first\n      return _doSwap();\n    }\n    return false;\n  }\n\n  /**\n   * Check if the specified rectangular area is empty (no nodes occupy any part of it).\n   *\n   * @param x the x coordinate (column) of the area to check\n   * @param y the y coordinate (row) of the area to check\n   * @param w the width in columns of the area to check\n   * @param h the height in rows of the area to check\n   * @returns true if the area is completely empty, false if any node overlaps\n   *\n   * @example\n   * if (engine.isAreaEmpty(2, 1, 3, 2)) {\n   *   console.log('Area is available for placement');\n   * }\n   */\n  public isAreaEmpty(x: number, y: number, w: number, h: number): boolean {\n    const nn: GridStackNode = {x: x || 0, y: y || 0, w: w || 1, h: h || 1};\n    return !this.collide(nn);\n  }\n\n  /**\n   * Re-layout grid items to reclaim any empty space.\n   * This optimizes the grid layout by moving items to fill gaps.\n   *\n   * @param layout layout algorithm to use:\n   *   - 'compact' (default): find truly empty spaces, may reorder items\n   *   - 'list': keep the sort order exactly the same, move items up sequentially\n   * @param doSort if true (default), sort nodes by position before compacting\n   * @returns the engine instance for chaining\n   *\n   * @example\n   * // Compact to fill empty spaces\n   * engine.compact();\n   *\n   * // Compact preserving item order\n   * engine.compact('list');\n   */\n  public compact(layout: CompactOptions = 'compact', doSort = true): GridStackEngine {\n    if (this.nodes.length === 0) return this;\n    if (doSort) this.sortNodes();\n    const wasBatch = this.batchMode;\n    if (!wasBatch) this.batchUpdate();\n    const wasColumnResize = this._inColumnResize;\n    if (!wasColumnResize) this._inColumnResize = true; // faster addNode()\n    const copyNodes = this.nodes;\n    this.nodes = []; // pretend we have no nodes to conflict layout to start with...\n    copyNodes.forEach((n, index, list) => {\n      let after: GridStackNode;\n      if (!n.locked) {\n        n.autoPosition = true;\n        if (layout === 'list' && index) after = list[index - 1];\n      }\n      this.addNode(n, false, after); // 'false' for add event trigger\n    });\n    if (!wasColumnResize) delete this._inColumnResize;\n    if (!wasBatch) this.batchUpdate(false);\n    return this;\n  }\n\n  /**\n   * Enable/disable floating widgets (default: `false`).\n   * When floating is enabled, widgets can move up to fill empty spaces.\n   * See [example](http://gridstackjs.com/demo/float.html)\n   *\n   * @param val true to enable floating, false to disable\n   *\n   * @example\n   * engine.float = true;  // Enable floating\n   * engine.float = false; // Disable floating (default)\n   */\n  public set float(val: boolean) {\n    if (this._float === val) return;\n    this._float = val || false;\n    if (!val) {\n      this._packNodes()._notify();\n    }\n  }\n\n  /**\n   * Get the current floating mode setting.\n   *\n   * @returns true if floating is enabled, false otherwise\n   *\n   * @example\n   * const isFloating = engine.float;\n   * console.log('Floating enabled:', isFloating);\n   */\n  public get float(): boolean { return this._float || false; }\n\n  /**\n   * Sort the nodes array from first to last, or reverse.\n   * This is called during collision/placement operations to enforce a specific order.\n   *\n   * @param dir sort direction: 1 for ascending (first to last), -1 for descending (last to first)\n   * @returns the engine instance for chaining\n   *\n   * @example\n   * engine.sortNodes();    // Sort ascending (default)\n   * engine.sortNodes(-1);  // Sort descending\n   */\n  public sortNodes(dir: 1 | -1 = 1): GridStackEngine {\n    this.nodes = Utils.sort(this.nodes, dir);\n    return this;\n  }\n\n  /** @internal called to top gravity pack the items back OR revert back to original Y positions when floating */\n  protected _packNodes(): GridStackEngine {\n    if (this.batchMode) { return this; }\n    this.sortNodes(); // first to last\n\n    if (this.float) {\n      // restore original Y pos\n      this.nodes.forEach(n => {\n        if (n._updating || n._orig === undefined || n.y === n._orig.y) return;\n        let newY = n.y;\n        while (newY > n._orig.y) {\n          --newY;\n          const collide = this.collide(n, {x: n.x, y: newY, w: n.w, h: n.h});\n          if (!collide) {\n            n._dirty = true;\n            n.y = newY;\n          }\n        }\n      });\n    } else {\n      // top gravity pack\n      this.nodes.forEach((n, i) => {\n        if (n.locked) return;\n        while (n.y > 0) {\n          const newY = i === 0 ? 0 : n.y - 1;\n          const canBeMoved = i === 0 || !this.collide(n, {x: n.x, y: newY, w: n.w, h: n.h});\n          if (!canBeMoved) break;\n          // Note: must be dirty (from last position) for GridStack::OnChange CB to update positions\n          // and move items back. The user 'change' CB should detect changes from the original\n          // starting position instead.\n          n._dirty = (n.y !== newY);\n          n.y = newY;\n        }\n      });\n    }\n    return this;\n  }\n\n  /**\n   * Prepare and validate a node's coordinates and values for the current grid.\n   * This ensures the node has valid position, size, and properties before being added to the grid.\n   *\n   * @param node the node to prepare and validate\n   * @param resizing if true, resize the node down if it's out of bounds; if false, move it to fit\n   * @returns the prepared node with valid coordinates\n   *\n   * @example\n   * const node = { w: 3, h: 2, content: 'Hello' };\n   * const prepared = engine.prepareNode(node);\n   * console.log('Node prepared at:', prepared.x, prepared.y);\n   */\n  public prepareNode(node: GridStackNode, resizing?: boolean): GridStackNode {\n    node._id = node._id ?? GridStackEngine._idSeq++;\n\n    // make sure USER supplied id are unique in our list, else assign a new one as it will create issues during load/update/etc...\n    const id = node.id;\n    if (id) {\n      let count = 1; // append nice _n rather than some random number\n      while (this.nodes.find(n => n.id === node.id && n !== node)) {\n        node.id = id + '_' + (count++);\n      }\n    }\n\n    // if we're missing position, have the grid position us automatically (before we set them to 0,0)\n    if (node.x === undefined || node.y === undefined || node.x === null || node.y === null) {\n      node.autoPosition = true;\n    }\n\n    // assign defaults for missing required fields\n    const defaults: GridStackNode = { x: 0, y: 0, w: 1, h: 1};\n    Utils.defaults(node, defaults);\n\n    if (!node.autoPosition) { delete node.autoPosition; }\n    if (!node.noResize) { delete node.noResize; }\n    if (!node.noMove) { delete node.noMove; }\n    Utils.sanitizeMinMax(node);\n\n    // check for NaN (in case messed up strings were passed. can't do parseInt() || defaults.x above as 0 is valid #)\n    if (typeof node.x == 'string') { node.x = Number(node.x); }\n    if (typeof node.y == 'string') { node.y = Number(node.y); }\n    if (typeof node.w == 'string') { node.w = Number(node.w); }\n    if (typeof node.h == 'string') { node.h = Number(node.h); }\n    if (isNaN(node.x)) { node.x = defaults.x; node.autoPosition = true; }\n    if (isNaN(node.y)) { node.y = defaults.y; node.autoPosition = true; }\n    if (isNaN(node.w)) { node.w = defaults.w; }\n    if (isNaN(node.h)) { node.h = defaults.h; }\n\n    this.nodeBoundFix(node, resizing);\n    return node;\n  }\n\n  /**\n   * Part 2 of preparing a node to fit inside the grid - validates and fixes coordinates and dimensions.\n   * This ensures the node fits within grid boundaries and respects min/max constraints.\n   *\n   * @param node the node to validate and fix\n   * @param resizing if true, resize the node to fit; if false, move the node to fit\n   * @returns the engine instance for chaining\n   *\n   * @example\n   * // Fix a node that might be out of bounds\n   * engine.nodeBoundFix(node, true); // Resize to fit\n   * engine.nodeBoundFix(node, false); // Move to fit\n   */\n  public nodeBoundFix(node: GridStackNode, resizing?: boolean): GridStackEngine {\n\n    const before = node._orig || Utils.copyPos({}, node);\n\n    if (node.maxW) { node.w = Math.min(node.w || 1, node.maxW); }\n    if (node.maxH) { node.h = Math.min(node.h || 1, node.maxH); }\n    if (node.minW) { node.w = Math.max(node.w || 1, node.minW); }\n    if (node.minH) { node.h = Math.max(node.h || 1, node.minH); }\n\n    // if user loaded a larger than allowed widget for current # of columns,\n    // remember it's position & width so we can restore back (1 -> 12 column) #1655 #1985\n    // IFF we're not in the middle of column resizing!\n    const saveOrig = (node.x || 0) + (node.w || 1) > this.column;\n    if (saveOrig && this.column < this.defaultColumn && !this._inColumnResize && !this.skipCacheUpdate && node._id != null  && this.findCacheLayout(node, this.defaultColumn) === -1) {\n      const copy = {...node}; // need _id + positions\n      if (copy.autoPosition || copy.x === undefined) { delete copy.x; delete copy.y; }\n      else copy.x = Math.min(this.defaultColumn - 1, copy.x);\n      copy.w = Math.min(this.defaultColumn, copy.w || 1);\n      this.cacheOneLayout(copy, this.defaultColumn);\n    }\n\n    if (node.w > this.column) {\n      node.w = this.column;\n    } else if (node.w < 1) {\n      node.w = 1;\n    }\n\n    if (this.maxRow && node.h > this.maxRow) {\n      node.h = this.maxRow;\n    } else if (node.h < 1) {\n      node.h = 1;\n    }\n\n    if (node.x < 0) {\n      node.x = 0;\n    }\n    if (node.y < 0) {\n      node.y = 0;\n    }\n\n    if (node.x + node.w > this.column) {\n      if (resizing) {\n        node.w = this.column - node.x;\n      } else {\n        node.x = this.column - node.w;\n      }\n    }\n    if (this.maxRow && node.y + node.h > this.maxRow) {\n      if (resizing) {\n        node.h = this.maxRow - node.y;\n      } else {\n        node.y = this.maxRow - node.h;\n      }\n    }\n\n    if (!Utils.samePos(node, before)) {\n      node._dirty = true;\n    }\n\n    return this;\n  }\n\n  /**\n   * Returns a list of nodes that have been modified from their original values.\n   * This is used to track which nodes need DOM updates.\n   *\n   * @param verify if true, performs additional verification by comparing current vs original positions\n   * @returns array of nodes that have been modified\n   *\n   * @example\n   * const changed = engine.getDirtyNodes();\n   * console.log('Modified nodes:', changed.length);\n   *\n   * // Get verified dirty nodes\n   * const verified = engine.getDirtyNodes(true);\n   */\n  public getDirtyNodes(verify?: boolean): GridStackNode[] {\n    // compare original x,y,w,h instead as _dirty can be a temporary state\n    if (verify) {\n      return this.nodes.filter(n => n._dirty && !Utils.samePos(n, n._orig));\n    }\n    return this.nodes.filter(n => n._dirty);\n  }\n\n  /** @internal call this to call onChange callback with dirty nodes so DOM can be updated */\n  protected _notify(removedNodes?: GridStackNode[]): GridStackEngine {\n    if (this.batchMode || !this.onChange) return this;\n    const dirtyNodes = (removedNodes || []).concat(this.getDirtyNodes());\n    this.onChange(dirtyNodes);\n    return this;\n  }\n\n  /**\n   * Clean all dirty and last tried information from nodes.\n   * This resets the dirty state tracking for all nodes.\n   *\n   * @returns the engine instance for chaining\n   *\n   * @internal\n   */\n  public cleanNodes(): GridStackEngine {\n    if (this.batchMode) return this;\n    this.nodes.forEach(n => {\n      delete n._dirty;\n      delete n._lastTried;\n    });\n    return this;\n  }\n\n  /**\n   * Save the initial position/size of all nodes to track real dirty state.\n   * This creates a snapshot of current positions that can be restored later.\n   *\n   * Note: Should be called right after change events and before move/resize operations.\n   *\n   * @returns the engine instance for chaining\n   *\n   * @internal\n   */\n  public saveInitial(): GridStackEngine {\n    this.nodes.forEach(n => {\n      n._orig = Utils.copyPos({}, n);\n      delete n._dirty;\n    });\n    this._hasLocked = this.nodes.some(n => n.locked);\n    return this;\n  }\n\n  /**\n   * Restore all nodes back to their initial values.\n   * This is typically called when canceling an operation (e.g., Esc key during drag).\n   *\n   * @returns the engine instance for chaining\n   *\n   * @internal\n   */\n  public restoreInitial(): GridStackEngine {\n    this.nodes.forEach(n => {\n      if (!n._orig || Utils.samePos(n, n._orig)) return;\n      Utils.copyPos(n, n._orig);\n      n._dirty = true;\n    });\n    this._notify();\n    return this;\n  }\n\n  /**\n   * Find the first available empty spot for the given node dimensions.\n   * Updates the node's x,y attributes with the found position.\n   *\n   * @param node the node to find a position for (w,h must be set)\n   * @param nodeList optional list of nodes to check against (defaults to engine nodes)\n   * @param column optional column count (defaults to engine column count)\n   * @param after optional node to start search after (maintains order)\n   * @returns true if an empty position was found and node was updated\n   *\n   * @example\n   * const node = { w: 2, h: 1 };\n   * if (engine.findEmptyPosition(node)) {\n   *   console.log('Found position at:', node.x, node.y);\n   * }\n   */\n  public findEmptyPosition(node: GridStackNode, nodeList = this.nodes, column = this.column, after?: GridStackNode): boolean {\n    const start = after ? after.y * column + (after.x + after.w) : 0;\n    let found = false;\n    for (let i = start; !found; ++i) {\n      const x = i % column;\n      const y = Math.floor(i / column);\n      if (x + node.w > column) {\n        continue;\n      }\n      const box = {x, y, w: node.w, h: node.h};\n      if (!nodeList.find(n => Utils.isIntercepted(box, n))) {\n        if (node.x !== x || node.y !== y) node._dirty = true;\n        node.x = x;\n        node.y = y;\n        delete node.autoPosition;\n        found = true;\n      }\n    }\n    return found;\n  }\n\n  /**\n   * Add the given node to the grid, handling collision detection and re-packing.\n   * This is the main method for adding new widgets to the engine.\n   *\n   * @param node the node to add to the grid\n   * @param triggerAddEvent if true, adds node to addedNodes list for event triggering\n   * @param after optional node to place this node after (for ordering)\n   * @returns the added node (or existing node if duplicate)\n   *\n   * @example\n   * const node = { x: 0, y: 0, w: 2, h: 1, content: 'Hello' };\n   * const added = engine.addNode(node, true);\n   */\n  public addNode(node: GridStackNode, triggerAddEvent = false, after?: GridStackNode): GridStackNode {\n    const dup = this.nodes.find(n => n._id === node._id);\n    if (dup) return dup; // prevent inserting twice! return it instead.\n\n    // skip prepareNode if we're in middle of column resize (not new) but do check for bounds!\n    this._inColumnResize ? this.nodeBoundFix(node) : this.prepareNode(node);\n    delete node._temporaryRemoved;\n    delete node._removeDOM;\n\n    let skipCollision: boolean;\n    if (node.autoPosition && this.findEmptyPosition(node, this.nodes, this.column, after)) {\n      delete node.autoPosition; // found our slot\n      skipCollision = true;\n    }\n\n    this.nodes.push(node);\n    if (triggerAddEvent) { this.addedNodes.push(node); }\n\n    if (!skipCollision) this._fixCollisions(node);\n    if (!this.batchMode) { this._packNodes()._notify(); }\n    return node;\n  }\n\n  /**\n   * Remove the given node from the grid.\n   *\n   * @param node the node to remove\n   * @param removeDOM if true (default), marks node for DOM removal\n   * @param triggerEvent if true, adds node to removedNodes list for event triggering\n   * @returns the engine instance for chaining\n   *\n   * @example\n   * engine.removeNode(node, true, true);\n   */\n  public removeNode(node: GridStackNode, removeDOM = true, triggerEvent = false): GridStackEngine {\n    if (!this.nodes.find(n => n._id === node._id)) {\n      // TEST console.log(`Error: GridStackEngine.removeNode() node._id=${node._id} not found!`)\n      return this;\n    }\n    if (triggerEvent) { // we wait until final drop to manually track removed items (rather than during drag)\n      this.removedNodes.push(node);\n    }\n    if (removeDOM) node._removeDOM = true; // let CB remove actual HTML (used to set _id to null, but then we loose layout info)\n    // don't use 'faster' .splice(findIndex(),1) in case node isn't in our list, or in multiple times.\n    this.nodes = this.nodes.filter(n => n._id !== node._id);\n    if (!node._isAboutToRemove) this._packNodes(); // if dragged out, no need to relayout as already done...\n    this._notify([node]);\n    return this;\n  }\n\n  /**\n   * Remove all nodes from the grid.\n   *\n   * @param removeDOM if true (default), marks all nodes for DOM removal\n   * @param triggerEvent if true (default), triggers removal events\n   * @returns the engine instance for chaining\n   *\n   * @example\n   * engine.removeAll(); // Remove all nodes\n   */\n  public removeAll(removeDOM = true, triggerEvent = true): GridStackEngine {\n    delete this._layouts;\n    if (!this.nodes.length) return this;\n    removeDOM && this.nodes.forEach(n => n._removeDOM = true); // let CB remove actual HTML (used to set _id to null, but then we loose layout info)\n    const removedNodes = this.nodes;\n    this.removedNodes = triggerEvent ? removedNodes : [];\n    this.nodes = [];\n    return this._notify(removedNodes);\n  }\n\n  /**\n   * Check if a node can be moved to a new position, considering layout constraints.\n   * This is a safer version of moveNode() that validates the move first.\n   *\n   * For complex cases (like maxRow constraints), it simulates the move in a clone first,\n   * then applies the changes only if they meet all specifications.\n   *\n   * @param node the node to move\n   * @param o move options including target position\n   * @returns true if the node was successfully moved\n   *\n   * @example\n   * const canMove = engine.moveNodeCheck(node, { x: 2, y: 1 });\n   * if (canMove) {\n   *   console.log('Node moved successfully');\n   * }\n   */\n  public moveNodeCheck(node: GridStackNode, o: GridStackMoveOpts): boolean {\n    // if (node.locked) return false;\n    if (!this.changedPosConstrain(node, o)) return false;\n    o.pack = true;\n\n    // simpler case: move item directly...\n    if (!this.maxRow) {\n      return this.moveNode(node, o);\n    }\n\n    // complex case: create a clone with NO maxRow (will check for out of bounds at the end)\n    let clonedNode: GridStackNode;\n    const clone = new GridStackEngine({\n      column: this.column,\n      float: this.float,\n      nodes: this.nodes.map(n => {\n        if (n._id === node._id) {\n          clonedNode = {...n};\n          return clonedNode;\n        }\n        return {...n};\n      })\n    });\n    if (!clonedNode) return false;\n\n    // check if we're covering 50% collision and could move, while still being under maxRow or at least not making it worse\n    // (case where widget was somehow added past our max #2449)\n    const canMove = clone.moveNode(clonedNode, o) && clone.getRow() <= Math.max(this.getRow(), this.maxRow);\n    // else check if we can force a swap (float=true, or different shapes) on non-resize\n    if (!canMove && !o.resizing && o.collide) {\n      const collide = o.collide.el.gridstackNode; // find the source node the clone collided with at 50%\n      if (this.swap(node, collide)) { // swaps and mark dirty\n        this._notify();\n        return true;\n      }\n    }\n    if (!canMove) return false;\n\n    // if clone was able to move, copy those mods over to us now instead of caller trying to do this all over!\n    // Note: we can't use the list directly as elements and other parts point to actual node, so copy content\n    clone.nodes.filter(n => n._dirty).forEach(c => {\n      const n = this.nodes.find(a => a._id === c._id);\n      if (!n) return;\n      Utils.copyPos(n, c);\n      n._dirty = true;\n    });\n    this._notify();\n    return true;\n  }\n\n  /** return true if can fit in grid height constrain only (always true if no maxRow) */\n  public willItFit(node: GridStackNode): boolean {\n    delete node._willFitPos;\n    if (!this.maxRow) return true;\n    // create a clone with NO maxRow and check if still within size\n    const clone = new GridStackEngine({\n      column: this.column,\n      float: this.float,\n      nodes: this.nodes.map(n => {return {...n}})\n    });\n    const n = {...node}; // clone node so we don't mod any settings on it but have full autoPosition and min/max as well! #1687\n    this.cleanupNode(n);\n    delete n.el; delete n._id; delete n.content; delete n.grid;\n    clone.addNode(n);\n    if (clone.getRow() <= this.maxRow) {\n      node._willFitPos = Utils.copyPos({}, n);\n      return true;\n    }\n    return false;\n  }\n\n  /** true if x,y or w,h are different after clamping to min/max */\n  public changedPosConstrain(node: GridStackNode, p: GridStackPosition): boolean {\n    // first make sure w,h are set for caller\n    p.w = p.w || node.w;\n    p.h = p.h || node.h;\n    if (node.x !== p.x || node.y !== p.y) return true;\n    // check constrained w,h\n    if (node.maxW) { p.w = Math.min(p.w, node.maxW); }\n    if (node.maxH) { p.h = Math.min(p.h, node.maxH); }\n    if (node.minW) { p.w = Math.max(p.w, node.minW); }\n    if (node.minH) { p.h = Math.max(p.h, node.minH); }\n    return (node.w !== p.w || node.h !== p.h);\n  }\n\n  /** return true if the passed in node was actually moved (checks for no-op and locked) */\n  public moveNode(node: GridStackNode, o: GridStackMoveOpts): boolean {\n    if (!node || /*node.locked ||*/ !o) return false;\n    let wasUndefinedPack: boolean;\n    if (o.pack === undefined && !this.batchMode) {\n      wasUndefinedPack = o.pack = true;\n    }\n\n    // constrain the passed in values and check if we're still changing our node\n    if (typeof o.x !== 'number') { o.x = node.x; }\n    if (typeof o.y !== 'number') { o.y = node.y; }\n    if (typeof o.w !== 'number') { o.w = node.w; }\n    if (typeof o.h !== 'number') { o.h = node.h; }\n    const resizing = (node.w !== o.w || node.h !== o.h);\n    const nn: GridStackNode = Utils.copyPos({}, node, true); // get min/max out first, then opt positions next\n    Utils.copyPos(nn, o);\n    this.nodeBoundFix(nn, resizing);\n    Utils.copyPos(o, nn);\n\n    if (!o.forceCollide && Utils.samePos(node, o)) return false;\n    const prevPos: GridStackPosition = Utils.copyPos({}, node);\n\n    // check if we will need to fix collision at our new location\n    const collides = this.collideAll(node, nn, o.skip);\n    let needToMove = true;\n    if (collides.length) {\n      const activeDrag = node._moving && !o.nested;\n      // check to make sure we actually collided over 50% surface area while dragging\n      let collide = activeDrag ? this.directionCollideCoverage(node, o, collides) : collides[0];\n      // if we're enabling creation of sub-grids on the fly, see if we're covering 80% of either one, if we didn't already do that\n      if (activeDrag && collide && node.grid?.opts?.subGridDynamic && !node.grid._isTemp) {\n        const over = Utils.areaIntercept(o.rect, collide._rect);\n        const a1 = Utils.area(o.rect);\n        const a2 = Utils.area(collide._rect);\n        const perc = over / (a1 < a2 ? a1 : a2);\n        if (perc > .8) {\n          collide.grid.makeSubGrid(collide.el, undefined, node);\n          collide = undefined;\n        }\n      }\n\n      if (collide) {\n        needToMove = !this._fixCollisions(node, nn, collide, o); // check if already moved...\n      } else {\n        needToMove = false; // we didn't cover >50% for a move, skip...\n        if (wasUndefinedPack) delete o.pack;\n      }\n    }\n\n    // now move (to the original ask vs the collision version which might differ) and repack things\n    if (needToMove && !Utils.samePos(node, nn)) {\n      node._dirty = true;\n      Utils.copyPos(node, nn);\n    }\n    if (o.pack) {\n      this._packNodes()\n        ._notify();\n    }\n    return !Utils.samePos(node, prevPos); // pack might have moved things back\n  }\n\n  public getRow(): number {\n    return this.nodes.reduce((row, n) => Math.max(row, n.y + n.h), 0);\n  }\n\n  public beginUpdate(node: GridStackNode): GridStackEngine {\n    if (!node._updating) {\n      node._updating = true;\n      delete node._skipDown;\n      if (!this.batchMode) this.saveInitial();\n    }\n    return this;\n  }\n\n  public endUpdate(): GridStackEngine {\n    const n = this.nodes.find(n => n._updating);\n    if (n) {\n      delete n._updating;\n      delete n._skipDown;\n    }\n    return this;\n  }\n\n  /** saves a copy of the largest column layout (eg 12 even when rendering 1 column) so we don't loose orig layout, unless explicity column\n   * count to use is given. returning a list of widgets for serialization\n   * @param saveElement if true (default), the element will be saved to GridStackWidget.el field, else it will be removed.\n   * @param saveCB callback for each node -> widget, so application can insert additional data to be saved into the widget data structure.\n   * @param column if provided, the grid will be saved for the given column count (IFF we have matching internal saved layout, or current layout).\n   * Note: nested grids will ALWAYS save the container w to match overall layouts (parent + child) to be consistent.\n  */\n  public save(saveElement = true, saveCB?: SaveFcn, column?: number): GridStackNode[] {\n    // use the highest layout for any saved info so we can have full detail on reload #1849\n    // unless we're given a column to match (always set for nested grids)\n    const len = this._layouts?.length || 0;\n    let layout: GridStackNode[];\n    if (len) {\n      if (column) {\n        if (column !== this.column) layout = this._layouts[column];\n      } else if (this.column !== len - 1) {\n        layout = this._layouts[len - 1];\n      }\n    }\n    const list: GridStackNode[] = [];\n    this.sortNodes();\n    this.nodes.forEach(n => {\n      const wl = layout?.find(l => l._id === n._id);\n      // use layout info fields instead if set\n      const w: GridStackNode = {...n, ...(wl || {})};\n      Utils.removeInternalForSave(w, !saveElement);\n      if (saveCB) saveCB(n, w);\n      list.push(w);\n    });\n    return list;\n  }\n\n  /** @internal called whenever a node is added or moved - updates the cached layouts */\n  public layoutsNodesChange(nodes: GridStackNode[]): GridStackEngine {\n    if (!this._layouts || this._inColumnResize) return this;\n    // remove smaller layouts - we will re-generate those on the fly... larger ones need to update\n    this._layouts.forEach((layout, column) => {\n      if (!layout || column === this.column) return this;\n      if (column < this.column) {\n        this._layouts[column] = undefined;\n      }\n      else {\n        // we save the original x,y,w (h isn't cached) to see what actually changed to propagate better.\n        // NOTE: we don't need to check against out of bound scaling/moving as that will be done when using those cache values. #1785\n        const ratio = column / this.column;\n        nodes.forEach(node => {\n          if (!node._orig) return; // didn't change (newly added ?)\n          const n = layout.find(l => l._id === node._id);\n          if (!n) return; // no cache for new nodes. Will use those values.\n          // Y changed, push down same amount\n          // TODO: detect doing item 'swaps' will help instead of move (especially in 1 column mode)\n          if (n.y >= 0 && node.y !== node._orig.y) {\n            n.y += (node.y - node._orig.y);\n            if (n.y < 0) n.y = 0;\n          }\n          // X changed, scale from new position\n          if (node.x !== node._orig.x) {\n            n.x = Math.round(node.x * ratio);\n            if (n.x < 0) n.x = 0;\n          }\n          // width changed, scale from new width\n          if (node.w !== node._orig.w) {\n            n.w = Math.round(node.w * ratio);\n            if (n.w < 1) n.w = 1;\n          }\n          // ...height always carries over from cache\n        });\n      }\n    });\n    return this;\n  }\n\n  /**\n   * @internal Called to scale the widget width & position up/down based on the column change.\n   * Note we store previous layouts (especially original ones) to make it possible to go\n   * from say 12 -> 1 -> 12 and get back to where we were.\n   *\n   * @param prevColumn previous number of columns\n   * @param column  new column number\n   * @param layout specify the type of re-layout that will happen (position, size, etc...).\n   * Note: items will never be outside of the current column boundaries. default (moveScale). Ignored for 1 column\n   */\n  public columnChanged(prevColumn: number, column: number, layout: ColumnOptions = 'moveScale'): GridStackEngine {\n    if (!this.nodes.length || !column || prevColumn === column) return this;\n\n    // simpler shortcuts layouts\n    const doCompact = layout === 'compact' || layout === 'list';\n    if (doCompact) {\n      this.sortNodes(1); // sort with original layout once and only once (new column will affect order otherwise)\n    }\n\n    // cache the current layout in case they want to go back (like 12 -> 1 -> 12) as it requires original data IFF we're sizing down (see below)\n    if (column < prevColumn) this.cacheLayout(this.nodes, prevColumn);\n    this.batchUpdate(); // do this EARLY as it will call saveInitial() so we can detect where we started for _dirty and collision\n    let newNodes: GridStackNode[] = [];\n    let nodes = doCompact ? this.nodes : Utils.sort(this.nodes, -1); // current column reverse sorting so we can insert last to front (limit collision)\n\n    // see if we have cached previous layout IFF we are going up in size (restore) otherwise always\n    // generate next size down from where we are (looks more natural as you gradually size down).\n    if (column > prevColumn && this._layouts) {\n      const cacheNodes = this._layouts[column] || [];\n      // ...if not, start with the largest layout (if not already there) as down-scaling is more accurate\n      // by pretending we came from that larger column by assigning those values as starting point\n      const lastIndex = this._layouts.length - 1;\n      if (!cacheNodes.length && prevColumn !== lastIndex && this._layouts[lastIndex]?.length) {\n        prevColumn = lastIndex;\n        this._layouts[lastIndex].forEach(cacheNode => {\n          const n = nodes.find(n => n._id === cacheNode._id);\n          if (n) {\n            // still current, use cache info positions\n            if (!doCompact && !cacheNode.autoPosition) {\n              n.x = cacheNode.x ?? n.x;\n              n.y = cacheNode.y ?? n.y;\n            }\n            n.w = cacheNode.w ?? n.w;\n            if (cacheNode.x == undefined || cacheNode.y === undefined) n.autoPosition = true;\n          }\n        });\n      }\n\n      // if we found cache re-use those nodes that are still current\n      cacheNodes.forEach(cacheNode => {\n        const j = nodes.findIndex(n => n._id === cacheNode._id);\n        if (j !== -1) {\n          const n = nodes[j];\n          // still current, use cache info positions\n          if (doCompact) {\n            n.w = cacheNode.w; // only w is used, and don't trim the list\n            return;\n          }\n          if (cacheNode.autoPosition || isNaN(cacheNode.x) || isNaN(cacheNode.y)) {\n            this.findEmptyPosition(cacheNode, newNodes);\n          }\n          if (!cacheNode.autoPosition) {\n            n.x = cacheNode.x ?? n.x;\n            n.y = cacheNode.y ?? n.y;\n            n.w = cacheNode.w ?? n.w;\n            newNodes.push(n);\n          }\n          nodes.splice(j, 1);\n        }\n      });\n    }\n\n    // much simpler layout that just compacts\n    if (doCompact) {\n      this.compact(layout, false);\n    } else {\n      // ...and add any extra non-cached ones\n      if (nodes.length) {\n        if (typeof layout === 'function') {\n          layout(column, prevColumn, newNodes, nodes);\n        } else {\n          const ratio = (doCompact || layout === 'none') ? 1 : column / prevColumn;\n          const move = (layout === 'move' || layout === 'moveScale');\n          const scale = (layout === 'scale' || layout === 'moveScale');\n          nodes.forEach(node => {\n            // NOTE: x + w could be outside of the grid, but addNode() below will handle that\n            node.x = (column === 1 ? 0 : (move ? Math.round(node.x * ratio) : Math.min(node.x, column - 1)));\n            node.w = ((column === 1 || prevColumn === 1) ? 1 : scale ? (Math.round(node.w * ratio) || 1) : (Math.min(node.w, column)));\n            newNodes.push(node);\n          });\n          nodes = [];\n        }\n      }\n\n      // finally re-layout them in reverse order (to get correct placement)\n      newNodes = Utils.sort(newNodes, -1);\n      this._inColumnResize = true; // prevent cache update\n      this.nodes = []; // pretend we have no nodes to start with (add() will use same structures) to simplify layout\n      newNodes.forEach(node => {\n        this.addNode(node, false); // 'false' for add event trigger\n        delete node._orig; // make sure the commit doesn't try to restore things back to original\n      });\n    }\n\n    this.nodes.forEach(n => delete n._orig); // clear _orig before batch=false so it doesn't handle float=true restore\n    this.batchUpdate(false, !doCompact);\n    delete this._inColumnResize;\n    return this;\n  }\n\n  /**\n   * call to cache the given layout internally to the given location so we can restore back when column changes size\n   * @param nodes list of nodes\n   * @param column corresponding column index to save it under\n   * @param clear if true, will force other caches to be removed (default false)\n   */\n  public cacheLayout(nodes: GridStackNode[], column: number, clear = false): GridStackEngine {\n    const copy: GridStackNode[] = [];\n    nodes.forEach((n, i) => {\n      // make sure we have an id in case this is new layout, else re-use id already set\n      if (n._id === undefined) {\n        const existing = n.id ? this.nodes.find(n2 => n2.id === n.id) : undefined; // find existing node using users id\n        n._id = existing?._id ?? GridStackEngine._idSeq++;\n      }\n      copy[i] = {x: n.x, y: n.y, w: n.w, _id: n._id} // only thing we change is x,y,w and id to find it back\n    });\n    this._layouts = clear ? [] : this._layouts || []; // use array to find larger quick\n    this._layouts[column] = copy;\n    return this;\n  }\n\n  /**\n   * call to cache the given node layout internally to the given location so we can restore back when column changes size\n   * @param node single node to cache\n   * @param column corresponding column index to save it under\n   */\n  public cacheOneLayout(n: GridStackNode, column: number): GridStackEngine {\n    n._id = n._id ?? GridStackEngine._idSeq++;\n    const l: GridStackNode = {x: n.x, y: n.y, w: n.w, _id: n._id}\n    if (n.autoPosition || n.x === undefined) { delete l.x; delete l.y; if (n.autoPosition) l.autoPosition = true; }\n    this._layouts = this._layouts || [];\n    this._layouts[column] = this._layouts[column] || [];\n    const index = this.findCacheLayout(n, column);\n    if (index === -1)\n      this._layouts[column].push(l);\n    else\n      this._layouts[column][index] = l;\n    return this;\n  }\n\n  protected findCacheLayout(n: GridStackNode, column: number): number | undefined {\n    return this._layouts?.[column]?.findIndex(l => l._id === n._id) ?? -1;\n  }\n\n  public removeNodeFromLayoutCache(n: GridStackNode) {\n    if (!this._layouts) {\n      return;\n    }\n    for (let i = 0; i < this._layouts.length; i++) {\n      const index = this.findCacheLayout(n, i);\n      if (index !== -1) {\n        this._layouts[i].splice(index, 1);\n      }\n    }\n  }\n\n  /** called to remove all internal values but the _id */\n  public cleanupNode(node: GridStackNode): GridStackEngine {\n    for (const prop in node) {\n      if (prop[0] === '_' && prop !== '_id') delete node[prop];\n    }\n    return this;\n  }\n}\n"
  },
  {
    "path": "src/gridstack.scss",
    "content": "/**\n * gridstack SASS styles 12.4.3\n * Copyright (c) 2021-2025 Alain Dumesny - see GridStack root license\n */\n\n $animation_speed: .3s !default;\n\n .grid-stack {\n   position: relative;\n }\n \n .grid-stack-rtl {\n   direction: ltr;\n   > .grid-stack-item {\n     direction: rtl;\n   }\n }\n \n .grid-stack-placeholder > .placeholder-content {\n   background-color: rgba(0,0,0,0.1);\n   margin: 0;\n   position: absolute;\n   width: auto;\n   z-index: 0 !important;\n }\n \n // make those more unique as to not conflict with side panel items\n .grid-stack > .grid-stack-item {\n   position: absolute;\n   padding: 0;\n   top: 0; left: 0; // some default to reduce at least first row/column inline styles\n   width: var(--gs-column-width); // reduce 1x1 items inline styles\n   height: var(--gs-cell-height);\n \n   > .grid-stack-item-content {\n     margin: 0;\n     position: absolute;\n     width: auto;\n     overflow-x: hidden;\n     overflow-y: auto;\n   }\n   &.size-to-content:not(.size-to-content-max) > .grid-stack-item-content {\n     overflow-y: hidden;\n   }\n }\n \n .grid-stack {\n   > .grid-stack-item > .grid-stack-item-content, \n   > .grid-stack-placeholder > .placeholder-content {\n     top: var(--gs-item-margin-top);\n     right: var(--gs-item-margin-right);\n     bottom: var(--gs-item-margin-bottom);\n     left: var(--gs-item-margin-left);\n   }\n }\n \n .grid-stack-item {\n   > .ui-resizable-handle {\n     position: absolute;\n     font-size: 0.1px;\n     display: block;\n     -ms-touch-action: none;\n     touch-action: none;\n   }\n \n   &.ui-resizable-disabled > .ui-resizable-handle,\n   &.ui-resizable-autohide > .ui-resizable-handle { display: none; }\n \n   > .ui-resizable-ne,\n   > .ui-resizable-nw,\n   > .ui-resizable-se,\n   > .ui-resizable-sw {\n     background-image: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" stroke=\"%23666\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" viewBox=\"0 0 20 20\"><path d=\"m10 3 2 2H8l2-2v14l-2-2h4l-2 2\"/></svg>');\n     background-repeat: no-repeat;\n     background-position: center;\n   }\n \n   > .ui-resizable-ne {\n     transform: rotate(45deg);\n   }\n   > .ui-resizable-sw {\n     transform: rotate(45deg);\n   }\n \n   > .ui-resizable-nw {\n     transform: rotate(-45deg);\n   }\n   > .ui-resizable-se {\n     transform: rotate(-45deg);\n   }\n \n   > .ui-resizable-nw { cursor: nw-resize; width: 20px; height: 20px; top: var(--gs-item-margin-top); left: var(--gs-item-margin-left); }\n   > .ui-resizable-n  { cursor: n-resize;  height: 10px; top: var(--gs-item-margin-top); left: 25px; right: 25px; }\n   > .ui-resizable-ne { cursor: ne-resize; width: 20px; height: 20px; top: var(--gs-item-margin-top); right: var(--gs-item-margin-right); }\n   > .ui-resizable-e  { cursor: e-resize;  width: 10px; top: 15px; bottom: 15px; right: var(--gs-item-margin-right);}\n   > .ui-resizable-se { cursor: se-resize; width: 20px; height: 20px; bottom: var(--gs-item-margin-bottom); right: var(--gs-item-margin-right); }\n   > .ui-resizable-s  { cursor: s-resize;  height: 10px; left: 25px; bottom: var(--gs-item-margin-bottom); right: 25px; }\n   > .ui-resizable-sw { cursor: sw-resize; width: 20px; height: 20px; bottom: var(--gs-item-margin-bottom); left: var(--gs-item-margin-left); }\n   > .ui-resizable-w  { cursor: w-resize;  width: 10px; top: 15px; bottom: 15px; left: var(--gs-item-margin-left); }\n \n   &.ui-draggable-dragging {\n     &> .ui-resizable-handle {\n       display: none !important;\n     }\n   }\n \n   &.ui-draggable-dragging {\n     will-change: left, top;\n   }\n \n   &.ui-resizable-resizing {\n     will-change: width, height;\n   }\n }\n \n // not .grid-stack-item specific to also affect dragIn regions\n .ui-draggable-dragging,\n .ui-resizable-resizing {\n   z-index: 10000; // bootstrap modal has a z-index of 1050\n \n   > .grid-stack-item-content {\n     box-shadow: 1px 4px 6px rgba(0, 0, 0, 0.2);\n     opacity: 0.8;\n   }\n }\n \n .grid-stack-animate,\n .grid-stack-animate .grid-stack-item {\n   transition: left $animation_speed, top $animation_speed, height $animation_speed, width $animation_speed;\n }\n \n .grid-stack-animate .grid-stack-item.ui-draggable-dragging,\n .grid-stack-animate .grid-stack-item.ui-resizable-resizing,\n .grid-stack-animate .grid-stack-item.grid-stack-placeholder{\n   transition: left 0s, top 0s, height 0s, width 0s;\n }\n \n // make those more unique as to not conflict with side panel items, but apply to all column layouts (so not in loop below)\n .grid-stack > .grid-stack-item[gs-y=\"0\"] {\n   top: 0px;\n }\n .grid-stack > .grid-stack-item[gs-x=\"0\"] {\n   left: 0%;\n }\n \n "
  },
  {
    "path": "src/gridstack.ts",
    "content": "/*!\r\n * GridStack 12.4.3\r\n * https://gridstackjs.com/\r\n *\r\n * Copyright (c) 2021-2025  Alain Dumesny\r\n * see root license https://github.com/gridstack/gridstack.js/tree/master/LICENSE\r\n */\r\nimport { GridStackEngine } from './gridstack-engine';\r\nimport { Utils, HeightData, DragTransform } from './utils';\r\nimport {\r\n  gridDefaults, ColumnOptions, GridItemHTMLElement, GridStackElement, GridStackEventHandlerCallback,\r\n  GridStackNode, GridStackWidget, numberOrString, DDUIData, DDDragOpt, GridStackPosition, GridStackOptions,\r\n  GridStackEventHandler, GridStackNodesHandler, AddRemoveFcn, SaveFcn, CompactOptions, GridStackMoveOpts, ResizeToContentFcn, GridStackDroppedHandler, GridStackElementHandler,\r\n  Position, RenderFcn,\r\n  GridStackMouseEvent\r\n} from './types';\r\n\r\n/*\r\n * and include D&D by default\r\n * TODO: while we could generate a gridstack-static.js at smaller size - saves about 31k (41k -> 72k)\r\n * I don't know how to generate the DD only code at the remaining 31k to delay load as code depends on Gridstack.ts\r\n * also it caused loading issues in prod - see https://github.com/gridstack/gridstack.js/issues/2039\r\n */\r\nimport { DDGridStack } from './dd-gridstack';\r\nimport { isTouch } from './dd-touch';\r\nimport { DDManager } from './dd-manager';\r\nimport { DDElementHost } from './dd-element'; /** global instance */\r\nconst dd = new DDGridStack;\r\n\r\n// export all dependent file as well to make it easier for users to just import the main file\r\nexport * from './types';\r\nexport * from './utils';\r\nexport * from './gridstack-engine';\r\nexport * from './dd-gridstack';\r\nexport * from './dd-manager';\r\nexport * from './dd-element';\r\nexport * from './dd-draggable';\r\nexport * from './dd-droppable';\r\nexport * from './dd-resizable';\r\nexport * from './dd-resizable-handle';\r\nexport * from './dd-base-impl';\r\n\r\nexport interface GridHTMLElement extends HTMLElement {\r\n  gridstack?: GridStack; // grid's parent DOM element points back to grid class\r\n}\r\n/** list of possible events, or space separated list of them */\r\nexport type GridStackEvent = 'added' | 'change' | 'disable' | 'drag' | 'dragstart' | 'dragstop' | 'dropped' |\r\n  'enable' | 'removed' | 'resize' | 'resizestart' | 'resizestop' | 'resizecontent';\r\n\r\n/** Defines the coordinates of an object */\r\nexport interface MousePosition {\r\n  top: number;\r\n  left: number;\r\n}\r\n\r\n/** Defines the position of a cell inside the grid*/\r\nexport interface CellPosition {\r\n  x: number;\r\n  y: number;\r\n}\r\n\r\n// extend with internal fields we need - TODO: move other items in here\r\ninterface InternalGridStackOptions extends GridStackOptions {\r\n  _alwaysShowResizeHandle?: true | false | 'mobile'; // so we can restore for save\r\n}\r\n\r\n/**\r\n * Main gridstack class - you will need to call `GridStack.init()` first to initialize your grid.\r\n * Note: your grid elements MUST have the following classes for the CSS layout to work:\r\n * @example\r\n * <div class=\"grid-stack\">\r\n *   <div class=\"grid-stack-item\">\r\n *     <div class=\"grid-stack-item-content\">Item 1</div>\r\n *   </div>\r\n * </div>\r\n */\r\nexport class GridStack {\r\n\r\n  /**\r\n   * initializing the HTML element, or selector string, into a grid will return the grid. Calling it again will\r\n   * simply return the existing instance (ignore any passed options). There is also an initAll() version that support\r\n   * multiple grids initialization at once. Or you can use addGrid() to create the entire grid from JSON.\r\n   * @param options grid options (optional)\r\n   * @param elOrString element or CSS selector (first one used) to convert to a grid (default to '.grid-stack' class selector)\r\n   *\r\n   * @example\r\n   * const grid = GridStack.init();\r\n   *\r\n   * Note: the HTMLElement (of type GridHTMLElement) will store a `gridstack: GridStack` value that can be retrieve later\r\n   * const grid = document.querySelector('.grid-stack').gridstack;\r\n   */\r\n  public static init(options: GridStackOptions = {}, elOrString: GridStackElement = '.grid-stack'): GridStack {\r\n    if (typeof document === 'undefined') return null; // temp workaround SSR\r\n    const el = GridStack.getGridElement(elOrString);\r\n    if (!el) {\r\n      if (typeof elOrString === 'string') {\r\n        console.error('GridStack.initAll() no grid was found with selector \"' + elOrString + '\" - element missing or wrong selector ?' +\r\n          '\\nNote: \".grid-stack\" is required for proper CSS styling and drag/drop, and is the default selector.');\r\n      } else {\r\n        console.error('GridStack.init() no grid element was passed.');\r\n      }\r\n      return null;\r\n    }\r\n    if (!el.gridstack) {\r\n      el.gridstack = new GridStack(el, Utils.cloneDeep(options));\r\n    }\r\n    return el.gridstack\r\n  }\r\n\r\n  /**\r\n   * Will initialize a list of elements (given a selector) and return an array of grids.\r\n   * @param options grid options (optional)\r\n   * @param selector elements selector to convert to grids (default to '.grid-stack' class selector)\r\n   *\r\n   * @example\r\n   * const grids = GridStack.initAll();\r\n   * grids.forEach(...)\r\n   */\r\n  public static initAll(options: GridStackOptions = {}, selector = '.grid-stack'): GridStack[] {\r\n    const grids: GridStack[] = [];\r\n    if (typeof document === 'undefined') return grids; // temp workaround SSR\r\n    GridStack.getGridElements(selector).forEach(el => {\r\n      if (!el.gridstack) {\r\n        el.gridstack = new GridStack(el, Utils.cloneDeep(options));\r\n      }\r\n      grids.push(el.gridstack);\r\n    });\r\n    if (grids.length === 0) {\r\n      console.error('GridStack.initAll() no grid was found with selector \"' + selector + '\" - element missing or wrong selector ?' +\r\n        '\\nNote: \".grid-stack\" is required for proper CSS styling and drag/drop, and is the default selector.');\r\n    }\r\n    return grids;\r\n  }\r\n\r\n  /**\r\n   * call to create a grid with the given options, including loading any children from JSON structure. This will call GridStack.init(), then\r\n   * grid.load() on any passed children (recursively). Great alternative to calling init() if you want entire grid to come from\r\n   * JSON serialized data, including options.\r\n   * @param parent HTML element parent to the grid\r\n   * @param opt grids options used to initialize the grid, and list of children\r\n   */\r\n  public static addGrid(parent: HTMLElement, opt: GridStackOptions = {}): GridStack {\r\n    if (!parent) return null;\r\n\r\n    let el = parent as GridHTMLElement;\r\n    if (el.gridstack) {\r\n      // already a grid - set option and load data\r\n      const grid = el.gridstack;\r\n      if (opt) grid.opts = { ...grid.opts, ...opt };\r\n      if (opt.children !== undefined) grid.load(opt.children);\r\n      return grid;\r\n    }\r\n\r\n    // create the grid element, but check if the passed 'parent' already has grid styling and should be used instead\r\n    const parentIsGrid = parent.classList.contains('grid-stack');\r\n    if (!parentIsGrid || GridStack.addRemoveCB) {\r\n      if (GridStack.addRemoveCB) {\r\n        el = GridStack.addRemoveCB(parent, opt, true, true);\r\n      } else {\r\n        el = Utils.createDiv(['grid-stack', opt.class], parent);\r\n      }\r\n    }\r\n\r\n    // create grid class and load any children\r\n    const grid = GridStack.init(opt, el);\r\n    return grid;\r\n  }\r\n\r\n  /** call this method to register your engine instead of the default one.\r\n   * See instead `GridStackOptions.engineClass` if you only need to\r\n   * replace just one instance.\r\n   */\r\n  static registerEngine(engineClass: typeof GridStackEngine): void {\r\n    GridStack.engineClass = engineClass;\r\n  }\r\n\r\n  /**\r\n   * callback method use when new items|grids needs to be created or deleted, instead of the default\r\n   * item: <div class=\"grid-stack-item\"><div class=\"grid-stack-item-content\">w.content</div></div>\r\n   * grid: <div class=\"grid-stack\">grid content...</div>\r\n   * add = true: the returned DOM element will then be converted to a GridItemHTMLElement using makeWidget()|GridStack:init().\r\n   * add = false: the item will be removed from DOM (if not already done)\r\n   * grid = true|false for grid vs grid-items\r\n   */\r\n  public static addRemoveCB?: AddRemoveFcn;\r\n\r\n  /**\r\n   * callback during saving to application can inject extra data for each widget, on top of the grid layout properties\r\n   */\r\n  public static saveCB?: SaveFcn;\r\n\r\n  /**\r\n   * callback to create the content of widgets so the app can control how to store and restore it\r\n   * By default this lib will do 'el.textContent = w.content' forcing text only support for avoiding potential XSS issues.\r\n   */\r\n  public static renderCB?: RenderFcn = (el: HTMLElement, w: GridStackNode) => { if (el && w?.content) el.textContent = w.content; };\r\n\r\n  /** called after a widget has been updated (eg: load() into an existing list of children) so application can do extra work */\r\n  public static updateCB?: (w: GridStackNode) => void;\r\n\r\n  /** callback to use for resizeToContent instead of the built in one */\r\n  public static resizeToContentCB?: ResizeToContentFcn;\r\n  /** parent class for sizing content. defaults to '.grid-stack-item-content' */\r\n  public static resizeToContentParent = '.grid-stack-item-content';\r\n\r\n  /** scoping so users can call GridStack.Utils.sort() for example */\r\n  public static Utils = Utils;\r\n\r\n  /** scoping so users can call new GridStack.Engine(12) for example */\r\n  public static Engine = GridStackEngine;\r\n\r\n  /** engine used to implement non DOM grid functionality */\r\n  public engine: GridStackEngine;\r\n\r\n  /** point to a parent grid item if we're nested (inside a grid-item in between 2 Grids) */\r\n  public parentGridNode?: GridStackNode;\r\n\r\n  /** time to wait for animation (if enabled) to be done so content sizing can happen */\r\n  public animationDelay = 300 + 10;\r\n\r\n  protected static engineClass: typeof GridStackEngine;\r\n  protected resizeObserver: ResizeObserver;\r\n\r\n  /** @internal true if we got created by drag over gesture, so we can removed on drag out (temporary) */\r\n  public _isTemp?: boolean;\r\n\r\n  /**\r\n   * @internal create placeholder DIV as needed\r\n   * @returns the placeholder element for indicating drop zones during drag operations\r\n   */\r\n  public get placeholder(): GridItemHTMLElement {\r\n    if (!this._placeholder) {\r\n      this._placeholder = Utils.createDiv([this.opts.placeholderClass, gridDefaults.itemClass, this.opts.itemClass]);\r\n      const placeholderChild = Utils.createDiv(['placeholder-content'], this._placeholder);\r\n      if (this.opts.placeholderText) {\r\n        placeholderChild.textContent = this.opts.placeholderText;\r\n      }\r\n    }\r\n    return this._placeholder;\r\n  }\r\n  /** @internal */\r\n  protected _placeholder: GridItemHTMLElement;\r\n  /** @internal prevent cached layouts from being updated when loading into small column layouts */\r\n  protected _ignoreLayoutsNodeChange: boolean;\r\n  /** @internal */\r\n  public _gsEventHandler = {};\r\n  /** @internal flag to keep cells square during resize */\r\n  protected _isAutoCellHeight: boolean;\r\n  /** @internal limit auto cell resizing method */\r\n  protected _sizeThrottle: () => void;\r\n  /** @internal limit auto cell resizing method */\r\n  protected prevWidth: number;\r\n  /** @internal extra row added when dragging at the bottom of the grid */\r\n  protected _extraDragRow = 0;\r\n  /** @internal true if nested grid should get column count from our width */\r\n  protected _autoColumn?: boolean;\r\n  /** @internal meant to store the scale of the active grid */\r\n  protected dragTransform: DragTransform = { xScale: 1, yScale: 1, xOffset: 0, yOffset: 0 };\r\n  protected responseLayout: ColumnOptions;\r\n  private _skipInitialResize: boolean;\r\n\r\n  /**\r\n   * Construct a grid item from the given element and options\r\n   * @param el the HTML element tied to this grid after it's been initialized\r\n   * @param opts grid options - public for classes to access, but use methods to modify!\r\n   */\r\n  public constructor(public el: GridHTMLElement, public opts: GridStackOptions = {}) {\r\n    el.gridstack = this;\r\n    this.opts = opts = opts || {}; // handles null/undefined/0\r\n\r\n    if (!el.classList.contains('grid-stack')) {\r\n      this.el.classList.add('grid-stack');\r\n    }\r\n\r\n    // if row property exists, replace minRow and maxRow instead\r\n    if (opts.row) {\r\n      opts.minRow = opts.maxRow = opts.row;\r\n      delete opts.row;\r\n    }\r\n    const rowAttr = Utils.toNumber(el.getAttribute('gs-row'));\r\n\r\n    // flag only valid in sub-grids (handled by parent, not here)\r\n    if (opts.column === 'auto') {\r\n      delete opts.column;\r\n    }\r\n    // save original setting so we can restore on save\r\n    if (opts.alwaysShowResizeHandle !== undefined) {\r\n      (opts as InternalGridStackOptions)._alwaysShowResizeHandle = opts.alwaysShowResizeHandle;\r\n    }\r\n\r\n    // cleanup responsive opts (must have columnWidth | breakpoints) then sort breakpoints by size (so we can match during resize)\r\n    const resp = opts.columnOpts;\r\n    if (resp) {\r\n      const bk = resp.breakpoints;\r\n      if (!resp.columnWidth && !bk?.length) {\r\n        delete opts.columnOpts;\r\n      } else {\r\n        resp.columnMax = resp.columnMax || 12;\r\n        if (bk?.length > 1) bk.sort((a, b) => (b.w || 0) - (a.w || 0));\r\n      }\r\n    }\r\n\r\n    // elements DOM attributes override any passed options (like CSS style) - merge the two together\r\n    const defaults: GridStackOptions = {\r\n      ...Utils.cloneDeep(gridDefaults),\r\n      column: Utils.toNumber(el.getAttribute('gs-column')) || gridDefaults.column,\r\n      minRow: rowAttr ? rowAttr : Utils.toNumber(el.getAttribute('gs-min-row')) || gridDefaults.minRow,\r\n      maxRow: rowAttr ? rowAttr : Utils.toNumber(el.getAttribute('gs-max-row')) || gridDefaults.maxRow,\r\n      staticGrid: Utils.toBool(el.getAttribute('gs-static')) || gridDefaults.staticGrid,\r\n      sizeToContent: Utils.toBool(el.getAttribute('gs-size-to-content')) || undefined,\r\n      draggable: {\r\n        handle: (opts.handleClass ? '.' + opts.handleClass : (opts.handle ? opts.handle : '')) || gridDefaults.draggable.handle,\r\n      },\r\n      removableOptions: {\r\n        accept: opts.itemClass || gridDefaults.removableOptions.accept,\r\n        decline: gridDefaults.removableOptions.decline\r\n      },\r\n    };\r\n    if (el.getAttribute('gs-animate')) { // default to true, but if set to false use that instead\r\n      defaults.animate = Utils.toBool(el.getAttribute('gs-animate'))\r\n    }\r\n\r\n    opts = Utils.defaults(opts, defaults);\r\n    this._initMargin(); // part of settings defaults...\r\n\r\n    // Now check if we're loading into !12 column mode FIRST so we don't do un-necessary work (like cellHeight = width / 12 then go 1 column)\r\n    this.checkDynamicColumn();\r\n    this._updateColumnVar(opts);\r\n\r\n    if (opts.rtl === 'auto') {\r\n      opts.rtl = (el.style.direction === 'rtl');\r\n    }\r\n    if (opts.rtl) {\r\n      this.el.classList.add('grid-stack-rtl');\r\n    }\r\n\r\n    // check if we're been nested, and if so update our style and keep pointer around (used during save)\r\n    const parentGridItem: GridItemHTMLElement = this.el.closest('.' + gridDefaults.itemClass);\r\n    const parentNode = parentGridItem?.gridstackNode;\r\n    if (parentNode) {\r\n      parentNode.subGrid = this;\r\n      this.parentGridNode = parentNode;\r\n      this.el.classList.add('grid-stack-nested');\r\n      parentNode.el.classList.add('grid-stack-sub-grid');\r\n    }\r\n\r\n    this._isAutoCellHeight = (opts.cellHeight === 'auto');\r\n    if (this._isAutoCellHeight || opts.cellHeight === 'initial') {\r\n      // make the cell content square initially (will use resize/column event to keep it square)\r\n      this.cellHeight(undefined);\r\n    } else {\r\n      // append unit if any are set\r\n      if (typeof opts.cellHeight == 'number' && opts.cellHeightUnit && opts.cellHeightUnit !== gridDefaults.cellHeightUnit) {\r\n        opts.cellHeight = opts.cellHeight + opts.cellHeightUnit;\r\n        delete opts.cellHeightUnit;\r\n      }\r\n      const val = opts.cellHeight;\r\n      delete opts.cellHeight; // force initial cellHeight() call to set the value\r\n      this.cellHeight(val);\r\n    }\r\n\r\n    // see if we need to adjust auto-hide\r\n    if (opts.alwaysShowResizeHandle === 'mobile') {\r\n      opts.alwaysShowResizeHandle = isTouch;\r\n    }\r\n\r\n    this._setStaticClass();\r\n\r\n    const engineClass = opts.engineClass || GridStack.engineClass || GridStackEngine;\r\n    this.engine = new engineClass({\r\n      column: this.getColumn(),\r\n      float: opts.float,\r\n      maxRow: opts.maxRow,\r\n      onChange: (cbNodes) => {\r\n        cbNodes.forEach(n => {\r\n          const el = n.el;\r\n          if (!el) return;\r\n          if (n._removeDOM) {\r\n            if (el) el.remove();\r\n            delete n._removeDOM;\r\n          } else {\r\n            this._writePosAttr(el, n);\r\n          }\r\n        });\r\n        this._updateContainerHeight();\r\n      }\r\n    });\r\n\r\n    if (opts.auto) {\r\n      this.batchUpdate(); // prevent in between re-layout #1535 TODO: this only set float=true, need to prevent collision check...\r\n      this.engine._loading = true; // loading collision check\r\n      this.getGridItems().forEach(el => this._prepareElement(el));\r\n      delete this.engine._loading;\r\n      this.batchUpdate(false);\r\n    }\r\n\r\n    // load any passed in children as well, which overrides any DOM layout done above\r\n    if (opts.children) {\r\n      const children = opts.children;\r\n      delete opts.children;\r\n      if (children.length) this.load(children); // don't load empty\r\n    }\r\n\r\n    this.setAnimation();\r\n\r\n    // dynamic grids require pausing during drag to detect over to nest vs push\r\n    if (opts.subGridDynamic && !DDManager.pauseDrag) DDManager.pauseDrag = true;\r\n    if (opts.draggable?.pause !== undefined) DDManager.pauseDrag = opts.draggable.pause;\r\n\r\n    this._setupRemoveDrop();\r\n    this._setupAcceptWidget();\r\n    this._updateResizeEvent();\r\n  }\r\n\r\n  private _updateColumnVar(opts: GridStackOptions = this.opts): void {\r\n    this.el.classList.add('gs-' + opts.column);\r\n    if (typeof opts.column === 'number') this.el.style.setProperty('--gs-column-width', `${100/opts.column}%`);\r\n  }\r\n\r\n  /**\r\n   * add a new widget and returns it.\r\n   *\r\n   * Widget will be always placed even if result height is more than actual grid height.\r\n   * You need to use `willItFit()` before calling addWidget for additional check.\r\n   * See also `makeWidget(el)` for DOM element.\r\n   *\r\n   * @example\r\n   * const grid = GridStack.init();\r\n   * grid.addWidget({w: 3, content: 'hello'});\r\n   *\r\n   * @param w GridStackWidget definition. used MakeWidget(el) if you have dom element instead.\r\n   */\r\n  public addWidget(w: GridStackWidget): GridItemHTMLElement {\r\n    if (!w) return;\r\n    if (typeof w === 'string') { console.error('V11: GridStack.addWidget() does not support string anymore. see #2736'); return; }\r\n    if ((w as HTMLElement).ELEMENT_NODE) { console.error('V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()'); return this.makeWidget(w as HTMLElement); }\r\n\r\n    let el: GridItemHTMLElement;\r\n    let node: GridStackNode = w;\r\n    node.grid = this;\r\n    if (node.el) {\r\n      el = node.el; // re-use element stored in the node\r\n    } else if (GridStack.addRemoveCB) {\r\n      el = GridStack.addRemoveCB(this.el, w, true, false);\r\n    } else {\r\n      el = this.createWidgetDivs(node);\r\n    }\r\n\r\n    if (!el) return;\r\n\r\n    // if the caller ended up initializing the widget in addRemoveCB, or we stared with one already, skip the rest\r\n    node = el.gridstackNode;\r\n    if (node && el.parentElement === this.el && this.engine.nodes.find(n => n._id === node._id)) return el;\r\n\r\n    // Tempting to initialize the passed in opt with default and valid values, but this break knockout demos\r\n    // as the actual value are filled in when _prepareElement() calls el.getAttribute('gs-xyz') before adding the node.\r\n    // So make sure we load any DOM attributes that are not specified in passed in options (which override)\r\n    const domAttr = this._readAttr(el);\r\n    Utils.defaults(w, domAttr);\r\n    this.engine.prepareNode(w);\r\n    // this._writeAttr(el, w); why write possibly incorrect values back when makeWidget() will ?\r\n\r\n    this.el.appendChild(el);\r\n\r\n    this.makeWidget(el, w);\r\n\r\n    return el;\r\n  }\r\n\r\n  /**\r\n   * Create the default grid item divs and content (possibly lazy loaded) by using GridStack.renderCB().\r\n   *\r\n   * @param n GridStackNode definition containing widget configuration\r\n   * @returns the created HTML element with proper grid item structure\r\n   *\r\n   * @example\r\n   * const element = grid.createWidgetDivs({ w: 2, h: 1, content: 'Hello World' });\r\n   */\r\n  public createWidgetDivs(n: GridStackNode): HTMLElement {\r\n    const el = Utils.createDiv(['grid-stack-item', this.opts.itemClass]);\r\n    const cont = Utils.createDiv(['grid-stack-item-content'], el);\r\n\r\n    if (Utils.lazyLoad(n)) {\r\n      if (!n.visibleObservable) {\r\n        n.visibleObservable = new IntersectionObserver(([entry]) => { if (entry.isIntersecting) {\r\n          n.visibleObservable?.disconnect();\r\n          delete n.visibleObservable;\r\n          GridStack.renderCB(cont, n);\r\n          n.grid?.prepareDragDrop(n.el);\r\n        }});\r\n        window.setTimeout(() => n.visibleObservable?.observe(el)); // wait until callee sets position attributes\r\n      }\r\n    } else GridStack.renderCB(cont, n);\r\n\r\n    return el;\r\n  }\r\n\r\n  /**\r\n   * Convert an existing gridItem element into a sub-grid with the given (optional) options, else inherit them\r\n   * from the parent's subGrid options.\r\n   * @param el gridItem element to convert\r\n   * @param ops (optional) sub-grid options, else default to node, then parent settings, else defaults\r\n   * @param nodeToAdd (optional) node to add to the newly created sub grid (used when dragging over existing regular item)\r\n   * @param saveContent if true (default) the html inside .grid-stack-content will be saved to child widget\r\n   * @returns newly created grid\r\n   */\r\n  public makeSubGrid(el: GridItemHTMLElement, ops?: GridStackOptions, nodeToAdd?: GridStackNode, saveContent = true): GridStack {\r\n    let node = el.gridstackNode;\r\n    if (!node) {\r\n      node = this.makeWidget(el).gridstackNode;\r\n    }\r\n    if (node.subGrid?.el) return node.subGrid; // already done\r\n\r\n    // find the template subGrid stored on a parent as fallback...\r\n    let subGridTemplate: GridStackOptions; // eslint-disable-next-line @typescript-eslint/no-this-alias\r\n    let grid: GridStack = this;\r\n    while (grid && !subGridTemplate) {\r\n      subGridTemplate = grid.opts?.subGridOpts;\r\n      grid = grid.parentGridNode?.grid;\r\n    }\r\n    //... and set the create options\r\n    ops = Utils.cloneDeep({\r\n      // by default sub-grid inherit from us | parent, other than id, children, etc...\r\n      ...this.opts, id: undefined, children: undefined, column: 'auto', columnOpts: undefined, layout: 'list', subGridOpts: undefined,\r\n      ...(subGridTemplate || {}),\r\n      ...(ops || node.subGridOpts || {})\r\n    });\r\n    node.subGridOpts = ops;\r\n\r\n    // if column special case it set, remember that flag and set default\r\n    let autoColumn: boolean;\r\n    if (ops.column === 'auto') {\r\n      autoColumn = true;\r\n      ops.column = Math.max(node.w || 1, nodeToAdd?.w || 1);\r\n      delete ops.columnOpts; // driven by parent\r\n    }\r\n\r\n    // if we're converting an existing full item, move over the content to be the first sub item in the new grid\r\n    let content = node.el.querySelector('.grid-stack-item-content') as HTMLElement;\r\n    let newItem: HTMLElement;\r\n    let newItemOpt: GridStackNode;\r\n    if (saveContent) {\r\n      this._removeDD(node.el); // remove D&D since it's set on content div\r\n      newItemOpt = { ...node, x: 0, y: 0 };\r\n      Utils.removeInternalForSave(newItemOpt);\r\n      delete newItemOpt.subGridOpts;\r\n      if (node.content) {\r\n        newItemOpt.content = node.content;\r\n        delete node.content;\r\n      }\r\n      if (GridStack.addRemoveCB) {\r\n        newItem = GridStack.addRemoveCB(this.el, newItemOpt, true, false);\r\n      } else {\r\n        newItem = Utils.createDiv(['grid-stack-item']);\r\n        newItem.appendChild(content);\r\n        content = Utils.createDiv(['grid-stack-item-content'], node.el);\r\n      }\r\n      this.prepareDragDrop(node.el); // ... and restore original D&D\r\n    }\r\n\r\n    // if we're adding an additional item, make the container large enough to have them both\r\n    if (nodeToAdd) {\r\n      const w = autoColumn ? ops.column : node.w;\r\n      const h = node.h + nodeToAdd.h;\r\n      const style = node.el.style;\r\n      style.transition = 'none'; // show up instantly so we don't see scrollbar with nodeToAdd\r\n      this.update(node.el, { w, h });\r\n      setTimeout(() => style.transition = null); // recover animation\r\n    }\r\n\r\n    const subGrid = node.subGrid = GridStack.addGrid(content, ops);\r\n    if (nodeToAdd?._moving) subGrid._isTemp = true; // prevent re-nesting as we add over\r\n    if (autoColumn) subGrid._autoColumn = true;\r\n\r\n    // add the original content back as a child of the newly created grid\r\n    if (saveContent) {\r\n      subGrid.makeWidget(newItem, newItemOpt);\r\n    }\r\n\r\n    // now add any additional node\r\n    if (nodeToAdd) {\r\n      if (nodeToAdd._moving) {\r\n        // create an artificial event even for the just created grid to receive this item\r\n        window.setTimeout(() => Utils.simulateMouseEvent(nodeToAdd._event, 'mouseenter', subGrid.el), 0);\r\n      } else {\r\n        subGrid.makeWidget(node.el, node);\r\n      }\r\n    }\r\n\r\n    // if sizedToContent, we need to re-calc the size of ourself\r\n    this.resizeToContentCheck(false, node);\r\n\r\n    return subGrid;\r\n  }\r\n\r\n  /**\r\n   * called when an item was converted into a nested grid to accommodate a dragged over item, but then item leaves - return back\r\n   * to the original grid-item. Also called to remove empty sub-grids when last item is dragged out (since re-creating is simple)\r\n   */\r\n  public removeAsSubGrid(nodeThatRemoved?: GridStackNode): void {\r\n    const pGrid = this.parentGridNode?.grid;\r\n    if (!pGrid) return;\r\n\r\n    pGrid.batchUpdate();\r\n    pGrid.removeWidget(this.parentGridNode.el, true, true);\r\n    this.engine.nodes.forEach(n => {\r\n      // migrate any children over and offsetting by our location\r\n      n.x += this.parentGridNode.x;\r\n      n.y += this.parentGridNode.y;\r\n      pGrid.makeWidget(n.el, n);\r\n    });\r\n    pGrid.batchUpdate(false);\r\n    if (this.parentGridNode) delete this.parentGridNode.subGrid;\r\n    delete this.parentGridNode;\r\n\r\n    // create an artificial event for the original grid now that this one is gone (got a leave, but won't get enter)\r\n    if (nodeThatRemoved) {\r\n      window.setTimeout(() => Utils.simulateMouseEvent(nodeThatRemoved._event, 'mouseenter', pGrid.el), 0);\r\n    }\r\n  }\r\n\r\n  /**\r\n   * saves the current layout returning a list of widgets for serialization which might include any nested grids.\r\n   * @param saveContent if true (default) the latest html inside .grid-stack-content will be saved to GridStackWidget.content field, else it will\r\n   * be removed.\r\n   * @param saveGridOpt if true (default false), save the grid options itself, so you can call the new GridStack.addGrid()\r\n   * to recreate everything from scratch. GridStackOptions.children would then contain the widget list instead.\r\n   * @param saveCB callback for each node -> widget, so application can insert additional data to be saved into the widget data structure.\r\n   * @param column if provided, the grid will be saved for the given column size (IFF we have matching internal saved layout, or current layout).\r\n   * Otherwise it will use the largest possible layout (say 12 even if rendering at 1 column) so we can restore to all layouts.\r\n   * NOTE: if you want to save to currently display layout, pass this.getColumn() as column.\r\n   * NOTE2: nested grids will ALWAYS save to the container size to be in sync with parent.\r\n   * @returns list of widgets or full grid option, including .children list of widgets\r\n   */\r\n  public save(saveContent = true, saveGridOpt = false, saveCB = GridStack.saveCB, column?: number): GridStackWidget[] | GridStackOptions {\r\n    // return copied GridStackWidget (with optionally .el) we can modify at will...\r\n    const list = this.engine.save(saveContent, saveCB, column);\r\n\r\n    // check for HTML content and nested grids\r\n    list.forEach(n => {\r\n      if (saveContent && n.el && !n.subGrid && !saveCB) { // sub-grid are saved differently, not plain content\r\n        const itemContent = n.el.querySelector('.grid-stack-item-content');\r\n        n.content = itemContent?.innerHTML;\r\n        if (!n.content) delete n.content;\r\n      } else {\r\n        if (!saveContent && !saveCB) { delete n.content; }\r\n        // check for nested grid - make sure it saves to the given container size to be consistent\r\n        if (n.subGrid?.el) {\r\n          const column = n.w || n.subGrid.getColumn();\r\n          const listOrOpt = n.subGrid.save(saveContent, saveGridOpt, saveCB, column);\r\n          n.subGridOpts = (saveGridOpt ? listOrOpt : { children: listOrOpt }) as GridStackOptions;\r\n          delete n.subGrid;\r\n        }\r\n      }\r\n      delete n.el;\r\n    });\r\n\r\n    // check if save entire grid options (needed for recursive) + children...\r\n    if (saveGridOpt) {\r\n      const o: InternalGridStackOptions = Utils.cloneDeep(this.opts);\r\n      // delete default values that will be recreated on launch\r\n      if (o.marginBottom === o.marginTop && o.marginRight === o.marginLeft && o.marginTop === o.marginRight) {\r\n        o.margin = o.marginTop;\r\n        delete o.marginTop; delete o.marginRight; delete o.marginBottom; delete o.marginLeft;\r\n      }\r\n      if (o.rtl === (this.el.style.direction === 'rtl')) { o.rtl = 'auto' }\r\n      if (this._isAutoCellHeight) {\r\n        o.cellHeight = 'auto'\r\n      }\r\n      if (this._autoColumn) {\r\n        o.column = 'auto';\r\n      }\r\n      const origShow = o._alwaysShowResizeHandle;\r\n      delete o._alwaysShowResizeHandle;\r\n      if (origShow !== undefined) {\r\n        o.alwaysShowResizeHandle = origShow;\r\n      } else {\r\n        delete o.alwaysShowResizeHandle;\r\n      }\r\n      Utils.removeInternalAndSame(o, gridDefaults);\r\n      o.children = list;\r\n      return o;\r\n    }\r\n\r\n    return list;\r\n  }\r\n\r\n  /**\r\n   * Load widgets from a list. This will call update() on each (matching by id) or add/remove widgets that are not there.\r\n   * Used to restore a grid layout for a saved layout list (see `save()`).\r\n   *\r\n   * @param items list of widgets definition to update/create\r\n   * @param addRemove boolean (default true) or callback method can be passed to control if and how missing widgets can be added/removed, giving\r\n   * the user control of insertion.\r\n   * @returns the grid instance for chaining\r\n   *\r\n   * @example\r\n   * // Basic usage with saved layout\r\n   * const savedLayout = grid.save(); // Save current layout\r\n   * // ... later restore it\r\n   * grid.load(savedLayout);\r\n   *\r\n   * // Load with custom add/remove callback\r\n   * grid.load(layout, (items, grid, add) => {\r\n   *   if (add) {\r\n   *     // Custom logic for adding new widgets\r\n   *     items.forEach(item => {\r\n   *       const el = document.createElement('div');\r\n   *       el.innerHTML = item.content || '';\r\n   *       grid.addWidget(el, item);\r\n   *     });\r\n   *   } else {\r\n   *     // Custom logic for removing widgets\r\n   *     items.forEach(item => grid.removeWidget(item.el));\r\n   *   }\r\n   * });\r\n   *\r\n   * // Load without adding/removing missing widgets\r\n   * grid.load(layout, false);\r\n   *\r\n   * @see {@link http://gridstackjs.com/demo/serialization.html} for complete example\r\n   */\r\n  public load(items: GridStackWidget[], addRemove: boolean | AddRemoveFcn = GridStack.addRemoveCB || true): GridStack {\r\n    // items = Utils.cloneDeep(items); // TODO: let callee decide by using directly instead of copy we can modify ?\r\n\r\n    // make sure size 1x1 (default) is present as it may need to override current sizes\r\n    items.forEach(n => { n.w = n.w || n.minW || 1; n.h = n.h || n.minH || 1 });\r\n\r\n    // sort items. those without coord will be appended last\r\n    items = Utils.sort(items);\r\n\r\n    this.engine.skipCacheUpdate = this._ignoreLayoutsNodeChange = true; // skip layout update\r\n\r\n    // if we're loading a layout into for example 1 column and items don't fit, make sure to save\r\n    // the original wanted layout so we can scale back up correctly #1471\r\n    let maxColumn = 0;\r\n    items.forEach(n => { maxColumn = Math.max(maxColumn, (n.x || 0) + n.w) });\r\n    if (maxColumn > this.engine.defaultColumn) this.engine.defaultColumn = maxColumn;\r\n    const column = this.getColumn();\r\n    if (maxColumn > column) {\r\n      // if we're loading (from empty) into a smaller column, check for special responsive layout\r\n      if (this.engine.nodes.length === 0 && this.responseLayout) {\r\n        this.engine.nodes = items;\r\n        this.engine.columnChanged(maxColumn, column, this.responseLayout);\r\n        items = this.engine.nodes;\r\n        this.engine.nodes = [];\r\n        delete this.responseLayout;\r\n      } else this.engine.cacheLayout(items, maxColumn, true);\r\n    }\r\n\r\n    // if given a different callback, temporally set it as global option so creating will use it\r\n    const prevCB = GridStack.addRemoveCB;\r\n    if (typeof (addRemove) === 'function') GridStack.addRemoveCB = addRemove as AddRemoveFcn;\r\n\r\n    const removed: GridStackNode[] = [];\r\n    this.batchUpdate();\r\n\r\n    // if we are loading from empty temporarily remove animation\r\n    const blank = !this.engine.nodes.length;\r\n    const noAnim = blank && this.opts.animate;\r\n    if (noAnim) this.setAnimation(false);\r\n\r\n    // see if any items are missing from new layout and need to be removed first\r\n    if (!blank && addRemove) {\r\n      const copyNodes = [...this.engine.nodes]; // don't loop through array you modify\r\n      copyNodes.forEach(n => {\r\n        if (!n.id) return;\r\n        const item = Utils.find(items, n.id);\r\n        if (!item) {\r\n          if (GridStack.addRemoveCB) GridStack.addRemoveCB(this.el, n, false, false);\r\n          removed.push(n); // batch keep track\r\n          this.removeWidget(n.el, true, false);\r\n        }\r\n      });\r\n    }\r\n\r\n    // now add/update the widgets - starting with removing items in the new layout we will reposition\r\n    // to reduce collision and add no-coord ones at next available spot\r\n    this.engine._loading = true; // help with collision\r\n    const updateNodes: GridStackWidget[] = [];\r\n    this.engine.nodes = this.engine.nodes.filter(n => {\r\n      if (Utils.find(items, n.id)) { updateNodes.push(n); return false; } // remove if found from list\r\n      return true;\r\n    });\r\n    items.forEach(w => {\r\n      const item = Utils.find(updateNodes, w.id);\r\n      if (item) {\r\n        // if item sizes to content, re-use the exiting height so it's a better guess at the final size (same if width doesn't change)\r\n        if (Utils.shouldSizeToContent(item)) w.h = item.h;\r\n        // check if missing coord, in which case find next empty slot with new (or old if missing) sizes\r\n        this.engine.nodeBoundFix(w);\r\n        if (w.autoPosition || w.x === undefined || w.y === undefined) {\r\n          w.w = w.w || item.w;\r\n          w.h = w.h || item.h;\r\n          this.engine.findEmptyPosition(w);\r\n        }\r\n\r\n        // add back to current list BUT force a collision check if it 'appears' we didn't change to make sure we don't overlap others now\r\n        this.engine.nodes.push(item);\r\n        if (Utils.samePos(item, w) && this.engine.nodes.length > 1) {\r\n          this.moveNode(item, { ...w, forceCollide: true });\r\n          Utils.copyPos(w, item); // use possily updated values before update() is called next (no-op since already moved)\r\n        }\r\n\r\n        this.update(item.el, w);\r\n\r\n        if (w.subGridOpts?.children) { // update any sub grid as well\r\n          const sub = item.el.querySelector('.grid-stack') as GridHTMLElement;\r\n          if (sub && sub.gridstack) {\r\n            sub.gridstack.load(w.subGridOpts.children); // TODO: support updating grid options ?\r\n          }\r\n        }\r\n      } else if (addRemove) {\r\n        this.addWidget(w);\r\n      }\r\n    });\r\n\r\n    delete this.engine._loading; // done loading\r\n    this.engine.removedNodes = removed;\r\n    this.batchUpdate(false);\r\n\r\n    // after commit, clear that flag\r\n    delete this._ignoreLayoutsNodeChange;\r\n    delete this.engine.skipCacheUpdate;\r\n    prevCB ? GridStack.addRemoveCB = prevCB : delete GridStack.addRemoveCB;\r\n    if (noAnim) this.setAnimation(true, true); // delay adding animation back\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * use before calling a bunch of `addWidget()` to prevent un-necessary relayouts in between (more efficient)\r\n   * and get a single event callback. You will see no changes until `batchUpdate(false)` is called.\r\n   */\r\n  public batchUpdate(flag = true): GridStack {\r\n    this.engine.batchUpdate(flag);\r\n    if (!flag) {\r\n      this._updateContainerHeight();\r\n      this._triggerRemoveEvent();\r\n      this._triggerAddEvent();\r\n      this._triggerChangeEvent();\r\n    }\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * Gets the current cell height in pixels. This takes into account the unit type and converts to pixels if necessary.\r\n   *\r\n   * @param forcePixel if true, forces conversion to pixels even when cellHeight is specified in other units\r\n   * @returns the cell height in pixels\r\n   *\r\n   * @example\r\n   * const height = grid.getCellHeight();\r\n   * console.log('Cell height:', height, 'px');\r\n   *\r\n   * // Force pixel conversion\r\n   * const pixelHeight = grid.getCellHeight(true);\r\n   */\r\n  public getCellHeight(forcePixel = false): number {\r\n    if (this.opts.cellHeight && this.opts.cellHeight !== 'auto' &&\r\n      (!forcePixel || !this.opts.cellHeightUnit || this.opts.cellHeightUnit === 'px')) {\r\n      return this.opts.cellHeight as number;\r\n    }\r\n    // do rem/em/cm/mm to px conversion\r\n    if (this.opts.cellHeightUnit === 'rem') {\r\n      return (this.opts.cellHeight as number) * parseFloat(getComputedStyle(document.documentElement).fontSize);\r\n    }\r\n    if (this.opts.cellHeightUnit === 'em') {\r\n      return (this.opts.cellHeight as number) * parseFloat(getComputedStyle(this.el).fontSize);\r\n    }\r\n    if (this.opts.cellHeightUnit === 'cm') {\r\n      // 1cm = 96px/2.54. See https://www.w3.org/TR/css-values-3/#absolute-lengths\r\n      return (this.opts.cellHeight as number) * (96 / 2.54);\r\n    }\r\n    if (this.opts.cellHeightUnit === 'mm') {\r\n      return (this.opts.cellHeight as number) * (96 / 2.54) / 10;\r\n    }\r\n    // else get first cell height\r\n    const el = this.el.querySelector('.' + this.opts.itemClass) as HTMLElement;\r\n    if (el) {\r\n      const h = Utils.toNumber(el.getAttribute('gs-h')) || 1; // since we don't write 1 anymore\r\n      return Math.round(el.offsetHeight / h);\r\n    }\r\n    // else do entire grid and # of rows (but doesn't work if min-height is the actual constrain)\r\n    const rows = parseInt(this.el.getAttribute('gs-current-row'));\r\n    return rows ? Math.round(this.el.getBoundingClientRect().height / rows) : this.opts.cellHeight as number;\r\n  }\r\n\r\n  /**\r\n   * Update current cell height - see `GridStackOptions.cellHeight` for format by updating eh Browser CSS variable.\r\n   *\r\n   * @param val the cell height. Options:\r\n   *   - `undefined`: cells content will be made square (match width minus margin)\r\n   *   - `0`: the CSS will be generated by the application instead\r\n   *   - number: height in pixels\r\n   *   - string: height with units (e.g., '70px', '5rem', '2em')\r\n   * @returns the grid instance for chaining\r\n   *\r\n   * @example\r\n   * grid.cellHeight(100);     // 100px height\r\n   * grid.cellHeight('70px');  // explicit pixel height\r\n   * grid.cellHeight('5rem');  // relative to root font size\r\n   * grid.cellHeight(grid.cellWidth() * 1.2); // aspect ratio\r\n   * grid.cellHeight('auto');  // auto-size based on content\r\n   */\r\n  public cellHeight(val?: numberOrString): GridStack {\r\n\r\n    // if not called internally, check if we're changing mode\r\n    if (val !== undefined) {\r\n      if (this._isAutoCellHeight !== (val === 'auto')) {\r\n        this._isAutoCellHeight = (val === 'auto');\r\n        this._updateResizeEvent();\r\n      }\r\n    }\r\n    if (val === 'initial' || val === 'auto') { val = undefined; }\r\n\r\n    // make item content be square\r\n    if (val === undefined) {\r\n      const marginDiff = - (this.opts.marginRight as number) - (this.opts.marginLeft as number)\r\n        + (this.opts.marginTop as number) + (this.opts.marginBottom as number);\r\n      val = this.cellWidth() + marginDiff;\r\n    }\r\n\r\n    const data = Utils.parseHeight(val);\r\n    if (this.opts.cellHeightUnit === data.unit && this.opts.cellHeight === data.h) {\r\n      return this;\r\n    }\r\n    this.opts.cellHeightUnit = data.unit;\r\n    this.opts.cellHeight = data.h;\r\n\r\n    // finally update var and container\r\n    this.el.style.setProperty('--gs-cell-height', `${this.opts.cellHeight}${this.opts.cellHeightUnit}`);\r\n    this._updateContainerHeight();\r\n    this.resizeToContentCheck();\r\n\r\n    return this;\r\n  }\r\n\r\n  /** Gets current cell width. */\r\n  /**\r\n   * Gets the current cell width in pixels. This is calculated based on the grid container width divided by the number of columns.\r\n   *\r\n   * @returns the cell width in pixels\r\n   *\r\n   * @example\r\n   * const width = grid.cellWidth();\r\n   * console.log('Cell width:', width, 'px');\r\n   *\r\n   * // Use cell width to calculate widget dimensions\r\n   * const widgetWidth = width * 3; // For a 3-column wide widget\r\n   */\r\n  public cellWidth(): number {\r\n    return this._widthOrContainer() / this.getColumn();\r\n  }\r\n\r\n  /** return our expected width (or parent) , and optionally of window for dynamic column check */\r\n  protected _widthOrContainer(forBreakpoint = false): number {\r\n    // use `offsetWidth` or `clientWidth` (no scrollbar) ?\r\n    // https://stackoverflow.com/questions/21064101/understanding-offsetwidth-clientwidth-scrollwidth-and-height-respectively\r\n    return forBreakpoint && this.opts.columnOpts?.breakpointForWindow ? window.innerWidth : (this.el.clientWidth || this.el.parentElement.clientWidth || window.innerWidth);\r\n  }\r\n\r\n  /** checks for dynamic column count for our current size, returning true if changed */\r\n  protected checkDynamicColumn(): boolean {\r\n    const resp = this.opts.columnOpts;\r\n    if (!resp || (!resp.columnWidth && !resp.breakpoints?.length)) return false;\r\n    const column = this.getColumn();\r\n    let newColumn = column;\r\n    const w = this._widthOrContainer(true);\r\n    if (resp.columnWidth) {\r\n      newColumn = Math.min(Math.round(w / resp.columnWidth) || 1, resp.columnMax);\r\n    } else {\r\n      // find the closest breakpoint (already sorted big to small) that matches\r\n      newColumn = resp.columnMax;\r\n      let i = 0;\r\n      while (i < resp.breakpoints.length && w <= resp.breakpoints[i].w) {\r\n        newColumn = resp.breakpoints[i++].c || column;\r\n      }\r\n    }\r\n    if (newColumn !== column) {\r\n      const bk = resp.breakpoints?.find(b => b.c === newColumn);\r\n      this.column(newColumn, bk?.layout || resp.layout);\r\n      return true;\r\n    }\r\n    return false;\r\n  }\r\n\r\n  /**\r\n   * Re-layout grid items to reclaim any empty space. This is useful after removing widgets\r\n   * or when you want to optimize the layout.\r\n   *\r\n   * @param layout layout type. Options:\r\n   *   - 'compact' (default): might re-order items to fill any empty space\r\n   *   - 'list': keep the widget left->right order the same, even if that means leaving an empty slot if things don't fit\r\n   * @param doSort re-sort items first based on x,y position. Set to false to do your own sorting ahead (default: true)\r\n   * @returns the grid instance for chaining\r\n   *\r\n   * @example\r\n   * // Compact layout after removing widgets\r\n   * grid.removeWidget('.widget-to-remove');\r\n   * grid.compact();\r\n   *\r\n   * // Use list layout (preserve order)\r\n   * grid.compact('list');\r\n   *\r\n   * // Compact without sorting first\r\n   * grid.compact('compact', false);\r\n   */\r\n  public compact(layout: CompactOptions = 'compact', doSort = true): GridStack {\r\n    this.engine.compact(layout, doSort);\r\n    this._triggerChangeEvent();\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * Set the number of columns in the grid. Will update existing widgets to conform to new number of columns,\r\n   * as well as cache the original layout so you can revert back to previous positions without loss.\r\n   *\r\n   * Requires `gridstack-extra.css` or `gridstack-extra.min.css` for [2-11] columns,\r\n   * else you will need to generate correct CSS.\r\n   * See: https://github.com/gridstack/gridstack.js#change-grid-columns\r\n   *\r\n   * @param column Integer > 0 (default 12)\r\n   * @param layout specify the type of re-layout that will happen. Options:\r\n   *   - 'moveScale' (default): scale widget positions and sizes\r\n   *   - 'move': keep widget sizes, only move positions\r\n   *   - 'scale': keep widget positions, only scale sizes\r\n   *   - 'none': don't change widget positions or sizes\r\n   *   Note: items will never be outside of the current column boundaries.\r\n   *   Ignored for `column=1` as we always want to vertically stack.\r\n   * @returns the grid instance for chaining\r\n   *\r\n   * @example\r\n   * // Change to 6 columns with default scaling\r\n   * grid.column(6);\r\n   *\r\n   * // Change to 4 columns, only move positions\r\n   * grid.column(4, 'move');\r\n   *\r\n   * // Single column layout (vertical stack)\r\n   * grid.column(1);\r\n   */\r\n  public column(column: number, layout: ColumnOptions = 'moveScale'): GridStack {\r\n    if (!column || column < 1 || this.opts.column === column) return this;\r\n\r\n    const oldColumn = this.getColumn();\r\n    this.opts.column = column;\r\n    if (!this.engine) {\r\n      // called in constructor, noting else to do but remember that breakpoint layout\r\n      this.responseLayout = layout;\r\n      return this;\r\n    }\r\n\r\n    this.engine.column = column;\r\n    this.el.classList.remove('gs-' + oldColumn);\r\n    this._updateColumnVar();\r\n\r\n    // update the items now\r\n    this.engine.columnChanged(oldColumn, column, layout);\r\n    if (this._isAutoCellHeight) this.cellHeight();\r\n\r\n    this.resizeToContentCheck(true); // wait for width resizing\r\n\r\n    // and trigger our event last...\r\n    this._ignoreLayoutsNodeChange = true; // skip layout update\r\n    this._triggerChangeEvent();\r\n    delete this._ignoreLayoutsNodeChange;\r\n\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * Get the number of columns in the grid (default 12).\r\n   *\r\n   * @returns the current number of columns in the grid\r\n   *\r\n   * @example\r\n   * const columnCount = grid.getColumn(); // returns 12 by default\r\n   */\r\n  public getColumn(): number { return this.opts.column as number; }\r\n\r\n  /**\r\n   * Returns an array of grid HTML elements (no placeholder) - used to iterate through our children in DOM order.\r\n   * This method excludes placeholder elements and returns only actual grid items.\r\n   *\r\n   * @returns array of GridItemHTMLElement instances representing all grid items\r\n   *\r\n   * @example\r\n   * const items = grid.getGridItems();\r\n   * items.forEach(item => {\r\n   *   console.log('Item ID:', item.gridstackNode.id);\r\n   * });\r\n   */\r\n  public getGridItems(): GridItemHTMLElement[] {\r\n    return Array.from(this.el.children)\r\n      .filter((el: HTMLElement) => el.matches('.' + this.opts.itemClass) && !el.matches('.' + this.opts.placeholderClass)) as GridItemHTMLElement[];\r\n  }\r\n\r\n  /**\r\n   * Returns true if change callbacks should be ignored due to column change, sizeToContent, loading, etc.\r\n   * This is useful for callers who want to implement dirty flag functionality.\r\n   *\r\n   * @returns true if change callbacks are currently being ignored\r\n   *\r\n   * @example\r\n   * if (!grid.isIgnoreChangeCB()) {\r\n   *   // Process the change event\r\n   *   console.log('Grid layout changed');\r\n   * }\r\n   */\r\n  public isIgnoreChangeCB(): boolean { return this._ignoreLayoutsNodeChange; }\r\n\r\n  /**\r\n   * Destroys a grid instance. DO NOT CALL any methods or access any vars after this as it will free up members.\r\n   * @param removeDOM if `false` grid and items HTML elements will not be removed from the DOM (Optional. Default `true`).\r\n   */\r\n  public destroy(removeDOM = true): GridStack {\r\n    if (!this.el) return; // prevent multiple calls\r\n    this.offAll();\r\n    this._updateResizeEvent(true);\r\n    this.setStatic(true, false); // permanently removes DD but don't set CSS class (we're going away)\r\n    this.setAnimation(false);\r\n    if (!removeDOM) {\r\n      this.removeAll(removeDOM);\r\n      this.el.removeAttribute('gs-current-row');\r\n    } else {\r\n      this.el.parentNode.removeChild(this.el);\r\n    }\r\n    if (this.parentGridNode) delete this.parentGridNode.subGrid;\r\n    delete this.parentGridNode;\r\n    delete this.opts;\r\n    delete this._placeholder?.gridstackNode;\r\n    delete this._placeholder;\r\n    delete this.engine;\r\n    delete this.el.gridstack; // remove circular dependency that would prevent a freeing\r\n    delete this.el;\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * Enable/disable floating widgets (default: `false`). When enabled, widgets can float up to fill empty spaces.\r\n   * See [example](http://gridstackjs.com/demo/float.html)\r\n   *\r\n   * @param val true to enable floating, false to disable\r\n   * @returns the grid instance for chaining\r\n   *\r\n   * @example\r\n   * grid.float(true);  // Enable floating\r\n   * grid.float(false); // Disable floating (default)\r\n   */\r\n  public float(val: boolean): GridStack {\r\n    if (this.opts.float !== val) {\r\n      this.opts.float = this.engine.float = val;\r\n      this._triggerChangeEvent();\r\n    }\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * Get the current float mode setting.\r\n   *\r\n   * @returns true if floating is enabled, false otherwise\r\n   *\r\n   * @example\r\n   * const isFloating = grid.getFloat();\r\n   * console.log('Floating enabled:', isFloating);\r\n   */\r\n  public getFloat(): boolean {\r\n    return this.engine.float;\r\n  }\r\n\r\n  /**\r\n   * Get the position of the cell under a pixel on screen.\r\n   * @param position the position of the pixel to resolve in\r\n   * absolute coordinates, as an object with top and left properties\r\n   * @param useDocRelative if true, value will be based on document position vs parent position (Optional. Default false).\r\n   * Useful when grid is within `position: relative` element\r\n   *\r\n   * Returns an object with properties `x` and `y` i.e. the column and row in the grid.\r\n   */\r\n  public getCellFromPixel(position: MousePosition, useDocRelative = false): CellPosition {\r\n    const box = this.el.getBoundingClientRect();\r\n    // console.log(`getBoundingClientRect left: ${box.left} top: ${box.top} w: ${box.w} h: ${box.h}`)\r\n    let containerPos: { top: number, left: number };\r\n    if (useDocRelative) {\r\n      containerPos = { top: box.top + document.documentElement.scrollTop, left: box.left };\r\n      // console.log(`getCellFromPixel scrollTop: ${document.documentElement.scrollTop}`)\r\n    } else {\r\n      containerPos = { top: this.el.offsetTop, left: this.el.offsetLeft }\r\n      // console.log(`getCellFromPixel offsetTop: ${containerPos.left} offsetLeft: ${containerPos.top}`)\r\n    }\r\n    const relativeLeft = position.left - containerPos.left;\r\n    const relativeTop = position.top - containerPos.top;\r\n\r\n    const columnWidth = (box.width / this.getColumn());\r\n    const rowHeight = (box.height / parseInt(this.el.getAttribute('gs-current-row')));\r\n\r\n    return { x: Math.floor(relativeLeft / columnWidth), y: Math.floor(relativeTop / rowHeight) };\r\n  }\r\n\r\n  /**\r\n   * Returns the current number of rows, which will be at least `minRow` if set.\r\n   * The row count is based on the highest positioned widget in the grid.\r\n   *\r\n   * @returns the current number of rows in the grid\r\n   *\r\n   * @example\r\n   * const rowCount = grid.getRow();\r\n   * console.log('Grid has', rowCount, 'rows');\r\n   */\r\n  public getRow(): number {\r\n    return Math.max(this.engine.getRow(), this.opts.minRow || 0);\r\n  }\r\n\r\n  /**\r\n   * Checks if the specified rectangular area is empty (no widgets occupy any part of it).\r\n   *\r\n   * @param x the x coordinate (column) of the area to check\r\n   * @param y the y coordinate (row) of the area to check\r\n   * @param w the width in columns of the area to check\r\n   * @param h the height in rows of the area to check\r\n   * @returns true if the area is completely empty, false if any widget overlaps\r\n   *\r\n   * @example\r\n   * // Check if a 2x2 area at position (1,1) is empty\r\n   * if (grid.isAreaEmpty(1, 1, 2, 2)) {\r\n   *   console.log('Area is available for placement');\r\n   * }\r\n   */\r\n  public isAreaEmpty(x: number, y: number, w: number, h: number): boolean {\r\n    return this.engine.isAreaEmpty(x, y, w, h);\r\n  }\r\n\r\n  /**\r\n   * If you add elements to your grid by hand (or have some framework creating DOM), you have to tell gridstack afterwards to make them widgets.\r\n   * If you want gridstack to add the elements for you, use `addWidget()` instead.\r\n   * Makes the given element a widget and returns it.\r\n   *\r\n   * @param els widget or single selector to convert.\r\n   * @param options widget definition to use instead of reading attributes or using default sizing values\r\n   * @returns the converted GridItemHTMLElement\r\n   *\r\n   * @example\r\n   * const grid = GridStack.init();\r\n   *\r\n   * // Create HTML content manually, possibly looking like:\r\n   * // <div id=\"item-1\" gs-x=\"0\" gs-y=\"0\" gs-w=\"3\" gs-h=\"2\"></div>\r\n   * grid.el.innerHTML = '<div id=\"item-1\" gs-w=\"3\"></div><div id=\"item-2\"></div>';\r\n   *\r\n   * // Convert existing elements to widgets\r\n   * grid.makeWidget('#item-1'); // Uses gs-* attributes from DOM\r\n   * grid.makeWidget('#item-2', {w: 2, h: 1, content: 'Hello World'});\r\n   *\r\n   * // Or pass DOM element directly\r\n   * const element = document.getElementById('item-3');\r\n   * grid.makeWidget(element, {x: 0, y: 1, w: 4, h: 2});\r\n   */\r\n  public makeWidget(els: GridStackElement, options?: GridStackWidget): GridItemHTMLElement {\r\n    const el = GridStack.getElement(els);\r\n    if (!el || el.gridstackNode) return el;\r\n    if (!el.parentElement) this.el.appendChild(el);\r\n    this._prepareElement(el, true, options);\r\n    const node = el.gridstackNode;\r\n\r\n    this._updateContainerHeight();\r\n\r\n    // see if there is a sub-grid to create\r\n    if (node.subGridOpts) {\r\n      this.makeSubGrid(el, node.subGridOpts, undefined, false); // node.subGrid will be used as option in method, no need to pass\r\n    }\r\n\r\n    // if we're adding an item into 1 column make sure\r\n    // we don't override the larger 12 column layout that was already saved. #1985\r\n    let resetIgnoreLayoutsNodeChange: boolean;\r\n    if (this.opts.column === 1 && !this._ignoreLayoutsNodeChange) {\r\n      resetIgnoreLayoutsNodeChange = this._ignoreLayoutsNodeChange = true;\r\n    }\r\n    this._triggerAddEvent();\r\n    this._triggerChangeEvent();\r\n    if (resetIgnoreLayoutsNodeChange) delete this._ignoreLayoutsNodeChange;\r\n\r\n    return el;\r\n  }\r\n\r\n  /**\r\n   * Register event handler for grid events. You can call this on a single event name, or space separated list.\r\n   *\r\n   * Supported events:\r\n   * - `added`: Called when widgets are being added to a grid\r\n   * - `change`: Occurs when widgets change their position/size due to constraints or direct changes\r\n   * - `disable`: Called when grid becomes disabled\r\n   * - `dragstart`: Called when grid item starts being dragged\r\n   * - `drag`: Called while grid item is being dragged (for each new row/column value)\r\n   * - `dragstop`: Called after user is done moving the item, with updated DOM attributes\r\n   * - `dropped`: Called when an item has been dropped and accepted over a grid\r\n   * - `enable`: Called when grid becomes enabled\r\n   * - `removed`: Called when items are being removed from the grid\r\n   * - `resizestart`: Called before user starts resizing an item\r\n   * - `resize`: Called while grid item is being resized (for each new row/column value)\r\n   * - `resizestop`: Called after user is done resizing the item, with updated DOM attributes\r\n   *\r\n   * @param name event name(s) to listen for (space separated for multiple)\r\n   * @param callback function to call when event occurs\r\n   * @returns the grid instance for chaining\r\n   *\r\n   * @example\r\n   * // Listen to multiple events at once\r\n   * grid.on('added removed change', (event, items) => {\r\n   *   items.forEach(item => console.log('Item changed:', item));\r\n   * });\r\n   *\r\n   * // Listen to individual events\r\n   * grid.on('added', (event, items) => {\r\n   *   items.forEach(item => console.log('Added item:', item));\r\n   * });\r\n   */\r\n  public on(name: 'dropped', callback: GridStackDroppedHandler): GridStack\r\n  public on(name: 'enable' | 'disable', callback: GridStackEventHandler): GridStack\r\n  public on(name: 'change' | 'added' | 'removed' | 'resizecontent', callback: GridStackNodesHandler): GridStack\r\n  public on(name: 'resizestart' | 'resize' | 'resizestop' | 'dragstart' | 'drag' | 'dragstop', callback: GridStackElementHandler): GridStack\r\n  public on(name: string, callback: GridStackEventHandlerCallback): GridStack\r\n  public on(name: GridStackEvent | string, callback: GridStackEventHandlerCallback): GridStack {\r\n    // check for array of names being passed instead\r\n    if (name.indexOf(' ') !== -1) {\r\n      const names = name.split(' ') as GridStackEvent[];\r\n      names.forEach(name => this.on(name, callback));\r\n      return this;\r\n    }\r\n\r\n    // native CustomEvent handlers - cash the generic handlers so we can easily remove\r\n    if (name === 'change' || name === 'added' || name === 'removed' || name === 'enable' || name === 'disable') {\r\n      const noData = (name === 'enable' || name === 'disable');\r\n      if (noData) {\r\n        this._gsEventHandler[name] = (event: Event) => (callback as GridStackEventHandler)(event);\r\n      } else {\r\n        this._gsEventHandler[name] = (event: CustomEvent) => {if (event.detail) (callback as GridStackNodesHandler)(event, event.detail)};\r\n      }\r\n      this.el.addEventListener(name, this._gsEventHandler[name]);\r\n    } else if (name === 'drag' || name === 'dragstart' || name === 'dragstop' || name === 'resizestart' || name === 'resize'\r\n      || name === 'resizestop' || name === 'dropped' || name === 'resizecontent') {\r\n      // drag&drop stop events NEED to be call them AFTER we update node attributes so handle them ourself.\r\n      // do same for start event to make it easier...\r\n      this._gsEventHandler[name] = callback;\r\n    } else {\r\n      console.error('GridStack.on(' + name + ') event not supported');\r\n    }\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * unsubscribe from the 'on' event GridStackEvent\r\n   * @param name of the event (see possible values) or list of names space separated\r\n   */\r\n  public off(name: GridStackEvent | string): GridStack {\r\n    // check for array of names being passed instead\r\n    if (name.indexOf(' ') !== -1) {\r\n      const names = name.split(' ') as GridStackEvent[];\r\n      names.forEach(name => this.off(name));\r\n      return this;\r\n    }\r\n\r\n    if (name === 'change' || name === 'added' || name === 'removed' || name === 'enable' || name === 'disable') {\r\n      // remove native CustomEvent handlers\r\n      if (this._gsEventHandler[name]) {\r\n        this.el.removeEventListener(name, this._gsEventHandler[name]);\r\n      }\r\n    }\r\n    delete this._gsEventHandler[name];\r\n\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * Remove all event handlers from the grid. This is useful for cleanup when destroying a grid.\r\n   *\r\n   * @returns the grid instance for chaining\r\n   *\r\n   * @example\r\n   * grid.offAll(); // Remove all event listeners\r\n   */\r\n  public offAll(): GridStack {\r\n    Object.keys(this._gsEventHandler).forEach((key: GridStackEvent) => this.off(key));\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * Removes widget from the grid.\r\n   * @param el  widget or selector to modify\r\n   * @param removeDOM if `false` DOM element won't be removed from the tree (Default? true).\r\n   * @param triggerEvent if `false` (quiet mode) element will not be added to removed list and no 'removed' callbacks will be called (Default? true).\r\n   */\r\n  public removeWidget(els: GridStackElement, removeDOM = true, triggerEvent = true): GridStack {\r\n    if (!els) { console.error('Error: GridStack.removeWidget(undefined) called'); return this; }\r\n\r\n    GridStack.getElements(els).forEach(el => {\r\n      if (el.parentElement && el.parentElement !== this.el) return; // not our child!\r\n      let node = el.gridstackNode;\r\n      // For Meteor support: https://github.com/gridstack/gridstack.js/pull/272\r\n      if (!node) {\r\n        node = this.engine.nodes.find(n => el === n.el);\r\n      }\r\n      if (!node) return;\r\n\r\n      if (removeDOM && GridStack.addRemoveCB) {\r\n        GridStack.addRemoveCB(this.el, node, false, false);\r\n      }\r\n\r\n      // remove our DOM data (circular link) and drag&drop permanently\r\n      delete el.gridstackNode;\r\n      this._removeDD(el);\r\n\r\n      this.engine.removeNode(node, removeDOM, triggerEvent);\r\n\r\n      if (removeDOM && el.parentElement) {\r\n        el.remove(); // in batch mode engine.removeNode doesn't call back to remove DOM\r\n      }\r\n    });\r\n    if (triggerEvent) {\r\n      this._triggerRemoveEvent();\r\n      this._triggerChangeEvent();\r\n    }\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * Removes all widgets from the grid.\r\n   * @param removeDOM if `false` DOM elements won't be removed from the tree (Default? `true`).\r\n   * @param triggerEvent if `false` (quiet mode) element will not be added to removed list and no 'removed' callbacks will be called (Default? true).\r\n   */\r\n  public removeAll(removeDOM = true, triggerEvent = true): GridStack {\r\n    // always remove our DOM data (circular link) before list gets emptied and drag&drop permanently\r\n    this.engine.nodes.forEach(n => {\r\n      if (removeDOM && GridStack.addRemoveCB) {\r\n        GridStack.addRemoveCB(this.el, n, false, false);\r\n      }\r\n      delete n.el.gridstackNode;\r\n      if (!this.opts.staticGrid) this._removeDD(n.el);\r\n    });\r\n    this.engine.removeAll(removeDOM, triggerEvent);\r\n    if (triggerEvent) this._triggerRemoveEvent();\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * Toggle the grid animation state.  Toggles the `grid-stack-animate` class.\r\n   * @param doAnimate if true the grid will animate.\r\n   * @param delay if true setting will be set on next event loop.\r\n   */\r\n  public setAnimation(doAnimate = this.opts.animate, delay?: boolean): GridStack {\r\n    if (delay) {\r\n      // delay, but check to make sure grid (opt) is still around\r\n      setTimeout(() => { if (this.opts) this.setAnimation(doAnimate) });\r\n    } else if (doAnimate) {\r\n      this.el.classList.add('grid-stack-animate');\r\n    } else {\r\n      this.el.classList.remove('grid-stack-animate');\r\n    }\r\n    this.opts.animate = doAnimate;\r\n    return this;\r\n  }\r\n\r\n  /** @internal */\r\n  private hasAnimationCSS(): boolean { return this.el.classList.contains('grid-stack-animate') }\r\n\r\n  /**\r\n   * Toggle the grid static state, which permanently removes/add Drag&Drop support, unlike disable()/enable() that just turns it off/on.\r\n   * Also toggle the grid-stack-static class.\r\n   * @param val if true the grid become static.\r\n   * @param updateClass true (default) if css class gets updated\r\n   * @param recurse true (default) if sub-grids also get updated\r\n   */\r\n  public setStatic(val: boolean, updateClass = true, recurse = true): GridStack {\r\n    if (!!this.opts.staticGrid === val) return this;\r\n    val ? this.opts.staticGrid = true : delete this.opts.staticGrid;\r\n    this._setupRemoveDrop();\r\n    this._setupAcceptWidget();\r\n    this.engine.nodes.forEach(n => {\r\n      this.prepareDragDrop(n.el); // either delete or init Drag&drop\r\n      if (n.subGrid && recurse) n.subGrid.setStatic(val, updateClass, recurse);\r\n    });\r\n    if (updateClass) { this._setStaticClass(); }\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * Updates the passed in options on the grid (similar to update(widget) for for the grid options).\r\n   * @param options PARTIAL grid options to update - only items specified will be updated.\r\n   * NOTE: not all options updating are currently supported (lot of code, unlikely to change)\r\n   */\r\n  public updateOptions(o: GridStackOptions): GridStack {\r\n    const opts = this.opts;\r\n    if (o === opts) return this; // nothing to do\r\n    if (o.acceptWidgets !== undefined) { opts.acceptWidgets = o.acceptWidgets; this._setupAcceptWidget(); }\r\n    if (o.animate !== undefined) this.setAnimation(o.animate);\r\n    if (o.cellHeight) this.cellHeight(o.cellHeight);\r\n    if (o.class !== undefined && o.class !== opts.class) { if (opts.class) this.el.classList.remove(opts.class); if (o.class) this.el.classList.add(o.class); }\r\n    // responsive column take over actual count (keep what we have now)\r\n    if (o.columnOpts) {\r\n      const hadColumnOpts = !!this.opts.columnOpts;\r\n      this.opts.columnOpts = o.columnOpts;\r\n      if (hadColumnOpts !== !!this.opts.columnOpts) this._updateResizeEvent();\r\n      this.checkDynamicColumn();\r\n    } else if (o.columnOpts === null && this.opts.columnOpts) { // delete update cmd\r\n      delete this.opts.columnOpts;\r\n      this._updateResizeEvent();\r\n    } else if (typeof(o.column) === 'number') this.column(o.column);\r\n    if (o.margin !== undefined) this.margin(o.margin);\r\n    if (o.staticGrid !== undefined) this.setStatic(o.staticGrid);\r\n    if (o.disableDrag !== undefined && !o.staticGrid) this.enableMove(!o.disableDrag);\r\n    if (o.disableResize !== undefined && !o.staticGrid) this.enableResize(!o.disableResize);\r\n    if (o.float !== undefined) this.float(o.float);\r\n    if (o.row !== undefined) {\r\n      opts.minRow = opts.maxRow = opts.row = o.row;\r\n      this._updateContainerHeight();\r\n    } else {\r\n      if (o.minRow !== undefined) { opts.minRow = o.minRow; this._updateContainerHeight(); }\r\n      if (o.maxRow !== undefined) opts.maxRow = this.engine.maxRow = o.maxRow;\r\n    }\r\n    if (o.lazyLoad !== undefined) opts.lazyLoad = o.lazyLoad;\r\n    if (o.children?.length) this.load(o.children);\r\n    // TBD if we have a real need for these (more complex code)\r\n    // alwaysShowResizeHandle, draggable, handle, handleClass, itemClass, layout, placeholderClass, placeholderText, resizable, removable, row,...\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * Updates widget position/size and other info. This is used to change widget properties after creation.\r\n   * Can update position, size, content, and other widget properties.\r\n   *\r\n   * Note: If you need to call this on all nodes, use load() instead which will update what changed.\r\n   * Setting the same x,y for multiple items will be indeterministic and likely unwanted.\r\n   *\r\n   * @param els widget element(s) or selector to modify\r\n   * @param opt new widget options (x,y,w,h, etc.). Only those set will be updated.\r\n   * @returns the grid instance for chaining\r\n   *\r\n   * @example\r\n   * // Update widget size and position\r\n   * grid.update('.my-widget', { x: 2, y: 1, w: 3, h: 2 });\r\n   *\r\n   * // Update widget content\r\n   * grid.update(widget, { content: '<p>New content</p>' });\r\n   *\r\n   * // Update multiple properties\r\n   * grid.update('#my-widget', {\r\n   *   w: 4,\r\n   *   h: 3,\r\n   *   noResize: true,\r\n   *   locked: true\r\n   * });\r\n   */\r\n  public update(els: GridStackElement, opt: GridStackWidget): GridStack {\r\n\r\n    GridStack.getElements(els).forEach(el => {\r\n      const n = el?.gridstackNode;\r\n      if (!n) return;\r\n      const w = {...Utils.copyPos({}, n), ...Utils.cloneDeep(opt)}; // make a copy we can modify in case they re-use it or multiple items\r\n      this.engine.nodeBoundFix(w);\r\n      delete w.autoPosition;\r\n\r\n      // move/resize widget if anything changed\r\n      const keys = ['x', 'y', 'w', 'h'];\r\n      let m: GridStackWidget;\r\n      if (keys.some(k => w[k] !== undefined && w[k] !== n[k])) {\r\n        m = {};\r\n        keys.forEach(k => {\r\n          m[k] = (w[k] !== undefined) ? w[k] : n[k];\r\n          delete w[k];\r\n        });\r\n      }\r\n      // for a move as well IFF there is any min/max fields set\r\n      if (!m && (w.minW || w.minH || w.maxW || w.maxH)) {\r\n        m = {}; // will use node position but validate values\r\n      }\r\n\r\n      // check for content changing\r\n      if (w.content !== undefined) {\r\n        const itemContent = el.querySelector('.grid-stack-item-content') as HTMLElement;\r\n        if (itemContent && itemContent.textContent !== w.content) {\r\n          n.content = w.content;\r\n          GridStack.renderCB(itemContent, w);\r\n          // restore any sub-grid back\r\n          if (n.subGrid?.el) {\r\n            itemContent.appendChild(n.subGrid.el);\r\n            n.subGrid._updateContainerHeight();\r\n          }\r\n        }\r\n        delete w.content;\r\n      }\r\n\r\n      // any remaining fields are assigned, but check for dragging changes, resize constrain\r\n      let changed = false;\r\n      let ddChanged = false;\r\n      for (const key in w) {\r\n        if (key[0] !== '_' && n[key] !== w[key]) {\r\n          n[key] = w[key];\r\n          changed = true;\r\n          ddChanged = ddChanged || (!this.opts.staticGrid && (key === 'noResize' || key === 'noMove' || key === 'locked'));\r\n        }\r\n      }\r\n      Utils.sanitizeMinMax(n);\r\n\r\n      // finally move the widget and update attr\r\n      if (m) {\r\n        const widthChanged = (m.w !== undefined && m.w !== n.w);\r\n        this.moveNode(n, m);\r\n        if (widthChanged && n.subGrid) {\r\n          // if we're animating the client size hasn't changed yet, so force a change (not exact size)\r\n          n.subGrid.onResize(this.hasAnimationCSS() ? n.w : undefined);\r\n        } else {\r\n          this.resizeToContentCheck(widthChanged, n);\r\n        }\r\n        delete n._orig; // clear out original position now that we moved #2669\r\n      }\r\n      if (m || changed) {\r\n        this._writeAttr(el, n);\r\n      }\r\n      if (ddChanged) {\r\n        this.prepareDragDrop(n.el);\r\n      }\r\n      if (GridStack.updateCB) GridStack.updateCB(n); // call user callback so they know widget got updated\r\n    });\r\n\r\n    return this;\r\n  }\r\n\r\n  private moveNode(n: GridStackNode, m: GridStackMoveOpts) {\r\n    const wasUpdating = n._updating;\r\n    if (!wasUpdating) this.engine.cleanNodes().beginUpdate(n);\r\n    this.engine.moveNode(n, m);\r\n    this._updateContainerHeight();\r\n    if (!wasUpdating) {\r\n      this._triggerChangeEvent();\r\n      this.engine.endUpdate();\r\n    }\r\n  }\r\n\r\n  /**\r\n   * Updates widget height to match the content height to avoid vertical scrollbars or dead space.\r\n   * This automatically adjusts the widget height based on its content size.\r\n   *\r\n   * Note: This assumes only 1 child under resizeToContentParent='.grid-stack-item-content'\r\n   * (sized to gridItem minus padding) that represents the entire content size.\r\n   *\r\n   * @param el the grid item element to resize\r\n   *\r\n   * @example\r\n   * // Resize a widget to fit its content\r\n   * const widget = document.querySelector('.grid-stack-item');\r\n   * grid.resizeToContent(widget);\r\n   *\r\n   * // This is commonly used with dynamic content:\r\n   * widget.querySelector('.content').innerHTML = 'New longer content...';\r\n   * grid.resizeToContent(widget);\r\n   */\r\n  public resizeToContent(el: GridItemHTMLElement) {\r\n    if (!el) return;\r\n    el.classList.remove('size-to-content-max');\r\n    if (!el.clientHeight) return; // 0 when hidden, skip\r\n    const n = el.gridstackNode;\r\n    if (!n) return;\r\n    const grid = n.grid;\r\n    if (!grid || el.parentElement !== grid.el) return; // skip if we are not inside a grid\r\n    const cell = grid.getCellHeight(true);\r\n    if (!cell) return;\r\n    let height = n.h ? n.h * cell : el.clientHeight; // getBoundingClientRect().height seem to flicker back and forth\r\n    let item: Element;\r\n    if (n.resizeToContentParent) item = el.querySelector(n.resizeToContentParent);\r\n    if (!item) item = el.querySelector(GridStack.resizeToContentParent);\r\n    if (!item) return;\r\n    const padding = el.clientHeight - item.clientHeight; // full - available height to our child (minus border, padding...)\r\n    const itemH = n.h ? n.h * cell - padding : item.clientHeight; // calculated to what cellHeight is or will become (rather than actual to prevent waiting for animation to finish)\r\n    let wantedH: number;\r\n    if (n.subGrid) {\r\n      // sub-grid - use their actual row count * their cell height, BUT append any content outside of the grid (eg: above text)\r\n      wantedH = n.subGrid.getRow() * n.subGrid.getCellHeight(true);\r\n      const subRec = n.subGrid.el.getBoundingClientRect();\r\n      const parentRec = el.getBoundingClientRect();\r\n      wantedH += subRec.top - parentRec.top;\r\n    } else if (n.subGridOpts?.children?.length) {\r\n      // not sub-grid just yet (case above) wait until we do\r\n      return;\r\n    } else {\r\n      // NOTE: clientHeight & getBoundingClientRect() is undefined for text and other leaf nodes. use <div> container!\r\n      const child = item.firstElementChild;\r\n      if (!child) {\r\n        console.error(`Error: GridStack.resizeToContent() widget id:${n.id} '${GridStack.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);\r\n        return;\r\n      }\r\n      wantedH = child.getBoundingClientRect().height || itemH;\r\n    }\r\n    if (itemH === wantedH) return;\r\n    height += wantedH - itemH;\r\n    let h = Math.ceil(height / cell);\r\n    // check for min/max and special sizing\r\n    const softMax = Number.isInteger(n.sizeToContent) ? n.sizeToContent as number : 0;\r\n    if (softMax && h > softMax) {\r\n      h = softMax;\r\n      el.classList.add('size-to-content-max');  // get v-scroll back\r\n    }\r\n    if (n.minH && h < n.minH) h = n.minH;\r\n    else if (n.maxH && h > n.maxH) h = n.maxH;\r\n    if (h !== n.h) {\r\n      grid._ignoreLayoutsNodeChange = true;\r\n      grid.moveNode(n, { h });\r\n      delete grid._ignoreLayoutsNodeChange;\r\n    }\r\n  }\r\n\r\n  /** call the user resize (so they can do extra work) else our build in version */\r\n  private resizeToContentCBCheck(el: GridItemHTMLElement) {\r\n    if (GridStack.resizeToContentCB) GridStack.resizeToContentCB(el);\r\n    else this.resizeToContent(el);\r\n  }\r\n\r\n  /**\r\n   * Rotate widgets by swapping their width and height. This is typically called when the user presses 'r' during dragging.\r\n   * The rotation swaps the w/h dimensions and adjusts min/max constraints accordingly.\r\n   *\r\n   * @param els widget element(s) or selector to rotate\r\n   * @param relative optional pixel coordinate relative to upper/left corner to rotate around (keeps that cell under cursor)\r\n   * @returns the grid instance for chaining\r\n   *\r\n   * @example\r\n   * // Rotate a specific widget\r\n   * grid.rotate('.my-widget');\r\n   *\r\n   * // Rotate with relative positioning during drag\r\n   * grid.rotate(widget, { left: 50, top: 30 });\r\n   */\r\n  public rotate(els: GridStackElement, relative?: Position): GridStack {\r\n    GridStack.getElements(els).forEach(el => {\r\n      const n = el.gridstackNode;\r\n      if (!Utils.canBeRotated(n)) return;\r\n      const rot: GridStackWidget = { w: n.h, h: n.w, minH: n.minW, minW: n.minH, maxH: n.maxW, maxW: n.maxH };\r\n      // if given an offset, adjust x/y by column/row bounds when user presses 'r' during dragging\r\n      if (relative) {\r\n        const pivotX = relative.left > 0 ? Math.floor(relative.left / this.cellWidth()) : 0;\r\n        const pivotY = relative.top > 0 ? Math.floor(relative.top / (this.opts.cellHeight as number)) : 0;\r\n        rot.x = n.x + pivotX - (n.h - (pivotY+1));\r\n        rot.y = (n.y + pivotY) - pivotX;\r\n      }\r\n      Object.keys(rot).forEach(k => { if (rot[k] === undefined) delete rot[k]; });\r\n      const _orig = n._orig;\r\n      this.update(el, rot);\r\n      n._orig = _orig; // restore as move() will delete it\r\n    });\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * Updates the margins which will set all 4 sides at once - see `GridStackOptions.margin` for format options.\r\n   * Supports CSS string format of 1, 2, or 4 values or a single number.\r\n   *\r\n   * @param value margin value - can be:\r\n   *   - Single number: `10` (applies to all sides)\r\n   *   - Two values: `'10px 20px'` (top/bottom, left/right)\r\n   *   - Four values: `'10px 20px 5px 15px'` (top, right, bottom, left)\r\n   * @returns the grid instance for chaining\r\n   *\r\n   * @example\r\n   * grid.margin(10);           // 10px all sides\r\n   * grid.margin('10px 20px');  // 10px top/bottom, 20px left/right\r\n   * grid.margin('5px 10px 15px 20px'); // Different for each side\r\n   */\r\n  public margin(value: numberOrString): GridStack {\r\n    const isMultiValue = (typeof value === 'string' && value.split(' ').length > 1);\r\n    // check if we can skip... won't check if multi values (too much hassle)\r\n    if (!isMultiValue) {\r\n      const data = Utils.parseHeight(value);\r\n      if (this.opts.marginUnit === data.unit && this.opts.margin === data.h) return;\r\n    }\r\n    // re-use existing margin handling\r\n    this.opts.margin = value;\r\n    this.opts.marginTop = this.opts.marginBottom = this.opts.marginLeft = this.opts.marginRight = undefined;\r\n    this._initMargin();\r\n\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * Returns the current margin value as a number (undefined if the 4 sides don't match).\r\n   * This only returns a number if all sides have the same margin value.\r\n   *\r\n   * @returns the margin value in pixels, or undefined if sides have different values\r\n   *\r\n   * @example\r\n   * const margin = grid.getMargin();\r\n   * if (margin !== undefined) {\r\n   *   console.log('Uniform margin:', margin, 'px');\r\n   * } else {\r\n   *   console.log('Margins are different on different sides');\r\n   * }\r\n   */\r\n  public getMargin(): number { return this.opts.margin as number; }\r\n\r\n  /**\r\n   * Returns true if the height of the grid will be less than the vertical\r\n   * constraint. Always returns true if grid doesn't have height constraint.\r\n   * @param node contains x,y,w,h,auto-position options\r\n   *\r\n   * @example\r\n   * if (grid.willItFit(newWidget)) {\r\n   *   grid.addWidget(newWidget);\r\n   * } else {\r\n   *   alert('Not enough free space to place the widget');\r\n   * }\r\n   */\r\n  public willItFit(node: GridStackWidget): boolean { return this.engine.willItFit(node) }\r\n\r\n  /** @internal */\r\n  protected _triggerChangeEvent(): GridStack {\r\n    if (this.engine.batchMode) return this;\r\n    const elements = this.engine.getDirtyNodes(true); // verify they really changed\r\n    if (elements && elements.length) {\r\n      if (!this._ignoreLayoutsNodeChange) {\r\n        this.engine.layoutsNodesChange(elements);\r\n      }\r\n      this._triggerEvent('change', elements);\r\n    }\r\n    this.engine.saveInitial(); // we called, now reset initial values & dirty flags\r\n    return this;\r\n  }\r\n\r\n  /** @internal */\r\n  protected _triggerAddEvent(): GridStack {\r\n    if (this.engine.batchMode) return this;\r\n    if (this.engine.addedNodes?.length) {\r\n      if (!this._ignoreLayoutsNodeChange) {\r\n        this.engine.layoutsNodesChange(this.engine.addedNodes);\r\n      }\r\n      // prevent added nodes from also triggering 'change' event (which is called next)\r\n      this.engine.addedNodes.forEach(n => { delete n._dirty; });\r\n      const addedNodes = [...this.engine.addedNodes];\r\n      this.engine.addedNodes = [];\r\n      this._triggerEvent('added', addedNodes);\r\n    }\r\n    return this;\r\n  }\r\n\r\n  /** @internal */\r\n  public _triggerRemoveEvent(): GridStack {\r\n    if (this.engine.batchMode) return this;\r\n    if (this.engine.removedNodes?.length) {\r\n      const removedNodes = [...this.engine.removedNodes];\r\n      this.engine.removedNodes = [];\r\n      this._triggerEvent('removed', removedNodes);\r\n    }\r\n    return this;\r\n  }\r\n\r\n  /** @internal */\r\n  protected _triggerEvent(type: string, data?: GridStackNode[]): GridStack {\r\n    const event = data ? new CustomEvent(type, { bubbles: false, detail: data }) : new Event(type);\r\n    // check if we're nested, and if so call the outermost grid to trigger the event\r\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\r\n    let grid: GridStack = this;\r\n    while (grid.parentGridNode) grid = grid.parentGridNode.grid;\r\n    grid.el.dispatchEvent(event);\r\n    return this;\r\n  }\r\n\r\n  /** @internal */\r\n  protected _updateContainerHeight(): GridStack {\r\n    if (!this.engine || this.engine.batchMode) return this;\r\n    const parent = this.parentGridNode;\r\n    let row = this.getRow() + this._extraDragRow; // this checks for minRow already\r\n    const cellHeight = this.opts.cellHeight as number;\r\n    const unit = this.opts.cellHeightUnit;\r\n    if (!cellHeight) return this;\r\n\r\n    // check for css min height (non nested grid). TODO: support mismatch, say: min % while unit is px.\r\n    // If `minRow` was applied, don't override it with this check, and avoid performance issues\r\n    // (reflows) using `getComputedStyle`\r\n    if (!parent && !this.opts.minRow) {\r\n      const cssMinHeight = Utils.parseHeight(getComputedStyle(this.el)['minHeight']);\r\n      if (cssMinHeight.h > 0 && cssMinHeight.unit === unit) {\r\n        const minRow = Math.floor(cssMinHeight.h / cellHeight);\r\n        if (row < minRow) {\r\n          row = minRow;\r\n        }\r\n      }\r\n    }\r\n\r\n    this.el.setAttribute('gs-current-row', String(row));\r\n    this.el.style.removeProperty('min-height');\r\n    this.el.style.removeProperty('height');\r\n    if (row) {\r\n      // nested grids have 'insert:0' to fill the space of parent by default, but we may be taller so use min-height for possible scrollbars\r\n      this.el.style[parent ? 'minHeight' : 'height'] = row * cellHeight + unit;\r\n    }\r\n\r\n    // if we're a nested grid inside an sizeToContent item, tell it to resize itself too\r\n    if (parent && Utils.shouldSizeToContent(parent)) {\r\n      parent.grid.resizeToContentCBCheck(parent.el);\r\n    }\r\n\r\n    return this;\r\n  }\r\n\r\n  /** @internal */\r\n  protected _prepareElement(el: GridItemHTMLElement, triggerAddEvent = false, node?: GridStackNode): GridStack {\r\n    node = node || this._readAttr(el);\r\n    el.gridstackNode = node;\r\n    node.el = el;\r\n    node.grid = this;\r\n    node = this.engine.addNode(node, triggerAddEvent);\r\n\r\n    // write the dom sizes and class\r\n    this._writeAttr(el, node);\r\n    el.classList.add(gridDefaults.itemClass, this.opts.itemClass);\r\n    const sizeToContent = Utils.shouldSizeToContent(node);\r\n    sizeToContent ? el.classList.add('size-to-content') : el.classList.remove('size-to-content');\r\n    if (sizeToContent) this.resizeToContentCheck(false, node);\r\n\r\n    if (!Utils.lazyLoad(node)) this.prepareDragDrop(node.el);\r\n\r\n    return this;\r\n  }\r\n\r\n  /** @internal write position CSS vars and x,y,w,h attributes (not used for CSS but by users) back to element */\r\n  protected _writePosAttr(el: HTMLElement, n: GridStackNode): GridStack {\r\n    // Avoid overwriting the inline style of the element during drag/resize, but always update the placeholder\r\n    if ((!n._moving && !n._resizing) || this._placeholder === el) {\r\n      // width/height:1 x/y:0 is set by default in the main CSS, so no need to set inlined vars\r\n      el.style.top = n.y ? (n.y === 1 ? `var(--gs-cell-height)` : `calc(${n.y} * var(--gs-cell-height))`) : null;\r\n      el.style.left = n.x ? (n.x === 1 ? `var(--gs-column-width)` : `calc(${n.x} * var(--gs-column-width))`) : null;\r\n      el.style.width = n.w > 1 ? `calc(${n.w} * var(--gs-column-width))` : null;\r\n      el.style.height = n.h > 1 ? `calc(${n.h} * var(--gs-cell-height))` : null;\r\n    }\r\n    // NOTE: those are technically not needed anymore (v12+) as we have CSS vars for everything, but some users depends on them to render item size using CSS\r\n    // ALways write x,y otherwise it could be autoPositioned incorrectly #3181\r\n    el.setAttribute('gs-x', String(n.x));\r\n    el.setAttribute('gs-y', String(n.y));\r\n    n.w > 1 ? el.setAttribute('gs-w', String(n.w)) : el.removeAttribute('gs-w');\r\n    n.h > 1 ? el.setAttribute('gs-h', String(n.h)) : el.removeAttribute('gs-h');\r\n    return this;\r\n  }\r\n\r\n  /** @internal call to write any default attributes back to element */\r\n  protected _writeAttr(el: HTMLElement, node: GridStackNode): GridStack {\r\n    if (!node) return this;\r\n    this._writePosAttr(el, node);\r\n\r\n    const attrs /*: GridStackWidget but strings */ = { // remaining attributes\r\n      // autoPosition: 'gs-auto-position', // no need to write out as already in node and doesn't affect CSS\r\n      noResize: 'gs-no-resize',\r\n      noMove: 'gs-no-move',\r\n      locked: 'gs-locked',\r\n      id: 'gs-id',\r\n      sizeToContent: 'gs-size-to-content',\r\n    };\r\n    for (const key in attrs) {\r\n      if (node[key]) { // 0 is valid for x,y only but done above already and not in list anyway\r\n        el.setAttribute(attrs[key], String(node[key]));\r\n      } else {\r\n        el.removeAttribute(attrs[key]);\r\n      }\r\n    }\r\n    return this;\r\n  }\r\n\r\n  /** @internal call to read any default attributes from element */\r\n  protected _readAttr(el: HTMLElement, clearDefaultAttr = true): GridStackWidget {\r\n    const n: GridStackNode = {};\r\n    n.x = Utils.toNumber(el.getAttribute('gs-x'));\r\n    n.y = Utils.toNumber(el.getAttribute('gs-y'));\r\n    n.w = Utils.toNumber(el.getAttribute('gs-w'));\r\n    n.h = Utils.toNumber(el.getAttribute('gs-h'));\r\n    n.autoPosition = Utils.toBool(el.getAttribute('gs-auto-position'));\r\n    n.noResize = Utils.toBool(el.getAttribute('gs-no-resize'));\r\n    n.noMove = Utils.toBool(el.getAttribute('gs-no-move'));\r\n    n.locked = Utils.toBool(el.getAttribute('gs-locked'));\r\n    const attr = el.getAttribute('gs-size-to-content');\r\n    if (attr) {\r\n      if (attr === 'true' || attr === 'false') n.sizeToContent = Utils.toBool(attr);\r\n      else n.sizeToContent = parseInt(attr, 10);\r\n    }\r\n    n.id = el.getAttribute('gs-id');\r\n\r\n    // read but never written out\r\n    n.maxW = Utils.toNumber(el.getAttribute('gs-max-w'));\r\n    n.minW = Utils.toNumber(el.getAttribute('gs-min-w'));\r\n    n.maxH = Utils.toNumber(el.getAttribute('gs-max-h'));\r\n    n.minH = Utils.toNumber(el.getAttribute('gs-min-h'));\r\n\r\n    // v8.x optimization to reduce un-needed attr that don't render or are default CSS\r\n    if (clearDefaultAttr) {\r\n      if (n.w === 1) el.removeAttribute('gs-w');\r\n      if (n.h === 1) el.removeAttribute('gs-h');\r\n      if (n.maxW) el.removeAttribute('gs-max-w');\r\n      if (n.minW) el.removeAttribute('gs-min-w');\r\n      if (n.maxH) el.removeAttribute('gs-max-h');\r\n      if (n.minH) el.removeAttribute('gs-min-h');\r\n    }\r\n\r\n    // remove any key not found (null or false which is default, unless sizeToContent=false override)\r\n    for (const key in n) {\r\n      if (!n.hasOwnProperty(key)) return;\r\n      if (!n[key] && n[key] !== 0 && key !== 'sizeToContent') { // 0 can be valid value (x,y only really)\r\n        delete n[key];\r\n      }\r\n    }\r\n\r\n    return n;\r\n  }\r\n\r\n  /** @internal */\r\n  protected _setStaticClass(): GridStack {\r\n    const classes = ['grid-stack-static'];\r\n\r\n    if (this.opts.staticGrid) {\r\n      this.el.classList.add(...classes);\r\n      this.el.setAttribute('gs-static', 'true');\r\n    } else {\r\n      this.el.classList.remove(...classes);\r\n      this.el.removeAttribute('gs-static');\r\n\r\n    }\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * called when we are being resized - check if the one Column Mode needs to be turned on/off\r\n   * and remember the prev columns we used, or get our count from parent, as well as check for cellHeight==='auto' (square)\r\n   * or `sizeToContent` gridItem options.\r\n   */\r\n  public onResize(clientWidth = this.el?.clientWidth): GridStack {\r\n    if (!clientWidth) return; // return if we're gone or no size yet (will get called again)\r\n    if (this.prevWidth === clientWidth) return; // no-op\r\n    this.prevWidth = clientWidth\r\n    // console.log('onResize ', clientWidth);\r\n\r\n    this.batchUpdate();\r\n\r\n    // see if we're nested and take our column count from our parent....\r\n    let columnChanged = false;\r\n    if (this._autoColumn && this.parentGridNode) {\r\n      if (this.opts.column !== this.parentGridNode.w) {\r\n        this.column(this.parentGridNode.w, this.opts.layout || 'list');\r\n        columnChanged = true;\r\n      }\r\n    } else {\r\n      // else check for dynamic column\r\n      columnChanged = this.checkDynamicColumn();\r\n    }\r\n\r\n    // make the cells content square again\r\n    if (this._isAutoCellHeight) this.cellHeight();\r\n\r\n    // update any nested grids, or items size\r\n    this.engine.nodes.forEach(n => {\r\n      if (n.subGrid) n.subGrid.onResize()\r\n    });\r\n\r\n    if (!this._skipInitialResize) this.resizeToContentCheck(columnChanged); // wait for anim of column changed (DOM reflow before we can size correctly)\r\n    delete this._skipInitialResize;\r\n\r\n    this.batchUpdate(false);\r\n\r\n    return this;\r\n  }\r\n\r\n  /** resizes content for given node (or all) if shouldSizeToContent() is true */\r\n  private resizeToContentCheck(delay = false, n: GridStackNode = undefined) {\r\n    if (!this.engine) return; // we've been deleted in between!\r\n\r\n    // update any gridItem height with sizeToContent, but wait for DOM $animation_speed to settle if we changed column count\r\n    // TODO: is there a way to know what the final (post animation) size of the content will be so we can animate the column width and height together rather than sequentially ?\r\n    if (delay && this.hasAnimationCSS()) return setTimeout(() => this.resizeToContentCheck(false, n), this.animationDelay);\r\n\r\n    if (n) {\r\n      if (Utils.shouldSizeToContent(n)) this.resizeToContentCBCheck(n.el);\r\n    } else if (this.engine.nodes.some(n => Utils.shouldSizeToContent(n))) {\r\n      const nodes = [...this.engine.nodes]; // in case order changes while resizing one\r\n      this.batchUpdate();\r\n      nodes.forEach(n => {\r\n        if (Utils.shouldSizeToContent(n)) this.resizeToContentCBCheck(n.el);\r\n      });\r\n      this._ignoreLayoutsNodeChange = true; // loop through each node will set/reset around each move, so set it here again\r\n      this.batchUpdate(false);\r\n      this._ignoreLayoutsNodeChange = false;\r\n    }\r\n    // call this regardless of shouldSizeToContent because widget might need to stretch to take available space after a resize\r\n    if (this._gsEventHandler['resizecontent']) this._gsEventHandler['resizecontent'](null, n ? [n] : this.engine.nodes);\r\n  }\r\n\r\n  /** add or remove the grid element size event handler */\r\n  protected _updateResizeEvent(forceRemove = false): GridStack {\r\n    // only add event if we're not nested (parent will call us) and we're auto sizing cells or supporting dynamic column (i.e. doing work)\r\n    // or supporting new sizeToContent option.\r\n    const trackSize = !this.parentGridNode && (this._isAutoCellHeight || this.opts.sizeToContent || this.opts.columnOpts\r\n      || this.engine.nodes.find(n => n.sizeToContent));\r\n\r\n    if (!forceRemove && trackSize && !this.resizeObserver) {\r\n      this._sizeThrottle = Utils.throttle(() => this.onResize(), this.opts.cellHeightThrottle);\r\n      this.resizeObserver = new ResizeObserver(() => this._sizeThrottle());\r\n      this.resizeObserver.observe(this.el);\r\n      this._skipInitialResize = true; // makeWidget will originally have called on startup\r\n    } else if ((forceRemove || !trackSize) && this.resizeObserver) {\r\n      this.resizeObserver.disconnect();\r\n      delete this.resizeObserver;\r\n      delete this._sizeThrottle;\r\n    }\r\n\r\n    return this;\r\n  }\r\n\r\n  /** @internal convert a potential selector into actual element */\r\n  public static getElement(els: GridStackElement = '.grid-stack-item'): GridItemHTMLElement { return Utils.getElement(els) }\r\n  /** @internal */\r\n  public static getElements(els: GridStackElement = '.grid-stack-item'): GridItemHTMLElement[] { return Utils.getElements(els) }\r\n  /** @internal */\r\n  public static getGridElement(els: GridStackElement): GridHTMLElement { return GridStack.getElement(els) }\r\n  /** @internal */\r\n  public static getGridElements(els: string): GridHTMLElement[] { return Utils.getElements(els) }\r\n\r\n  /** @internal initialize margin top/bottom/left/right and units */\r\n  protected _initMargin(): GridStack {\r\n    let data: HeightData;\r\n    let margin = 0;\r\n\r\n    // support passing multiple values like CSS (ex: '5px 10px 0 20px')\r\n    let margins: string[] = [];\r\n    if (typeof this.opts.margin === 'string') {\r\n      margins = this.opts.margin.split(' ')\r\n    }\r\n    if (margins.length === 2) { // top/bot, left/right like CSS\r\n      this.opts.marginTop = this.opts.marginBottom = margins[0];\r\n      this.opts.marginLeft = this.opts.marginRight = margins[1];\r\n    } else if (margins.length === 4) { // Clockwise like CSS\r\n      this.opts.marginTop = margins[0];\r\n      this.opts.marginRight = margins[1];\r\n      this.opts.marginBottom = margins[2];\r\n      this.opts.marginLeft = margins[3];\r\n    } else {\r\n      data = Utils.parseHeight(this.opts.margin);\r\n      this.opts.marginUnit = data.unit;\r\n      margin = this.opts.margin = data.h;\r\n    }\r\n\r\n    // see if top/bottom/left/right need to be set as well\r\n    const keys = ['marginTop', 'marginRight', 'marginBottom', 'marginLeft'];\r\n    keys.forEach(k => {\r\n      if (this.opts[k] === undefined) {\r\n        this.opts[k] = margin;\r\n      } else {\r\n        data = Utils.parseHeight(this.opts[k]);\r\n        this.opts[k] = data.h;\r\n        delete this.opts.margin;\r\n      }\r\n    });\r\n    this.opts.marginUnit = data.unit; // in case side were spelled out, use those units instead...\r\n    if (this.opts.marginTop === this.opts.marginBottom && this.opts.marginLeft === this.opts.marginRight && this.opts.marginTop === this.opts.marginRight) {\r\n      this.opts.margin = this.opts.marginTop; // makes it easier to check for no-ops in setMargin()\r\n    }\r\n\r\n    // finally Update the CSS margin variables (inside the cell height) */\r\n    const style = this.el.style;\r\n    style.setProperty('--gs-item-margin-top', `${this.opts.marginTop}${this.opts.marginUnit}`);\r\n    style.setProperty('--gs-item-margin-bottom', `${this.opts.marginBottom}${this.opts.marginUnit}`);\r\n    style.setProperty('--gs-item-margin-right', `${this.opts.marginRight}${this.opts.marginUnit}`);\r\n    style.setProperty('--gs-item-margin-left', `${this.opts.marginLeft}${this.opts.marginUnit}`);\r\n\r\n    return this;\r\n  }\r\n\r\n  /** @internal current version compiled in code */\r\n  static GDRev = '12.4.3';\r\n\r\n  /* ===========================================================================================\r\n   * drag&drop methods that used to be stubbed out and implemented in dd-gridstack.ts\r\n   * but caused loading issues in prod - see https://github.com/gridstack/gridstack.js/issues/2039\r\n   * ===========================================================================================\r\n   */\r\n\r\n  /**\r\n   * Get the global drag & drop implementation instance.\r\n   * This provides access to the underlying drag & drop functionality.\r\n   *\r\n   * @returns the DDGridStack instance used for drag & drop operations\r\n   *\r\n   * @example\r\n   * const dd = GridStack.getDD();\r\n   * // Access drag & drop functionality\r\n   */\r\n  public static getDD(): DDGridStack {\r\n    return dd;\r\n  }\r\n\r\n  /**\r\n   * call to setup dragging in from the outside (say toolbar), by specifying the class selection and options.\r\n   * Called during GridStack.init() as options, but can also be called directly (last param are used) in case the toolbar\r\n   * is dynamically create and needs to be set later.\r\n   * @param dragIn string selector (ex: '.sidebar-item') or list of dom elements\r\n   * @param dragInOptions options - see DDDragOpt. (default: {handle: '.grid-stack-item-content', appendTo: 'body'}\r\n   * @param widgets GridStackWidget def to assign to each element which defines what to create on drop\r\n   * @param root optional root which defaults to document (for shadow dom pass the parent HTMLDocument)\r\n   */\r\n  public static setupDragIn(dragIn?: string | HTMLElement[], dragInOptions?: DDDragOpt, widgets?: GridStackWidget[], root: HTMLElement | Document = document): void {\r\n    if (dragInOptions?.pause !== undefined) {\r\n      DDManager.pauseDrag = dragInOptions.pause;\r\n    }\r\n\r\n    dragInOptions = { appendTo: 'body', helper: 'clone', ...(dragInOptions || {}) }; // default to handle:undefined = drag by the whole item\r\n    const els = (typeof dragIn === 'string') ? Utils.getElements(dragIn, root) : dragIn;\r\n    els.forEach((el, i) => {\r\n      if (!dd.isDraggable(el)) dd.dragIn(el, dragInOptions);\r\n      if (widgets?.[i]) (el as GridItemHTMLElement).gridstackNode = widgets[i];\r\n    });\r\n  }\r\n\r\n  /**\r\n   * Enables/Disables dragging by the user for specific grid elements.\r\n   * For all items and future items, use enableMove() instead. No-op for static grids.\r\n   *\r\n   * Note: If you want to prevent an item from moving due to being pushed around by another\r\n   * during collision, use the 'locked' property instead.\r\n   *\r\n   * @param els widget element(s) or selector to modify\r\n   * @param val if true widget will be draggable, assuming the parent grid isn't noMove or static\r\n   * @returns the grid instance for chaining\r\n   *\r\n   * @example\r\n   * // Make specific widgets draggable\r\n   * grid.movable('.my-widget', true);\r\n   *\r\n   * // Disable dragging for specific widgets\r\n   * grid.movable('#fixed-widget', false);\r\n   */\r\n  public movable(els: GridStackElement, val: boolean): GridStack {\r\n    if (this.opts.staticGrid) return this; // can't move a static grid!\r\n    GridStack.getElements(els).forEach(el => {\r\n      const n = el.gridstackNode;\r\n      if (!n) return;\r\n      val ? delete n.noMove : n.noMove = true;\r\n      this.prepareDragDrop(n.el); // init DD if need be, and adjust\r\n    });\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * Enables/Disables user resizing for specific grid elements.\r\n   * For all items and future items, use enableResize() instead. No-op for static grids.\r\n   *\r\n   * @param els widget element(s) or selector to modify\r\n   * @param val if true widget will be resizable, assuming the parent grid isn't noResize or static\r\n   * @returns the grid instance for chaining\r\n   *\r\n   * @example\r\n   * // Make specific widgets resizable\r\n   * grid.resizable('.my-widget', true);\r\n   *\r\n   * // Disable resizing for specific widgets\r\n   * grid.resizable('#fixed-size-widget', false);\r\n   */\r\n  public resizable(els: GridStackElement, val: boolean): GridStack {\r\n    if (this.opts.staticGrid) return this; // can't resize a static grid!\r\n    GridStack.getElements(els).forEach(el => {\r\n      const n = el.gridstackNode;\r\n      if (!n) return;\r\n      val ? delete n.noResize : n.noResize = true;\r\n      this.prepareDragDrop(n.el); // init DD if need be, and adjust\r\n    });\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * Temporarily disables widgets moving/resizing.\r\n   * If you want a more permanent way (which freezes up resources) use `setStatic(true)` instead.\r\n   *\r\n   * Note: This is a no-op for static grids.\r\n   *\r\n   * This is a shortcut for:\r\n   * ```typescript\r\n   * grid.enableMove(false);\r\n   * grid.enableResize(false);\r\n   * ```\r\n   *\r\n   * @param recurse if true (default), sub-grids also get updated\r\n   * @returns the grid instance for chaining\r\n   *\r\n   * @example\r\n   * // Disable all interactions\r\n   * grid.disable();\r\n   *\r\n   * // Disable only this grid, not sub-grids\r\n   * grid.disable(false);\r\n   */\r\n  public disable(recurse = true): GridStack {\r\n    if (this.opts.staticGrid) return;\r\n    this.enableMove(false, recurse);\r\n    this.enableResize(false, recurse);\r\n    this._triggerEvent('disable');\r\n    return this;\r\n  }\r\n  /**\r\n   * Re-enables widgets moving/resizing - see disable().\r\n   * Note: This is a no-op for static grids.\r\n   *\r\n   * This is a shortcut for:\r\n   * ```typescript\r\n   * grid.enableMove(true);\r\n   * grid.enableResize(true);\r\n   * ```\r\n   *\r\n   * @param recurse if true (default), sub-grids also get updated\r\n   * @returns the grid instance for chaining\r\n   *\r\n   * @example\r\n   * // Re-enable all interactions\r\n   * grid.enable();\r\n   *\r\n   * // Enable only this grid, not sub-grids\r\n   * grid.enable(false);\r\n   */\r\n  public enable(recurse = true): GridStack {\r\n    if (this.opts.staticGrid) return;\r\n    this.enableMove(true, recurse);\r\n    this.enableResize(true, recurse);\r\n    this._triggerEvent('enable');\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * Enables/disables widget moving for all widgets. No-op for static grids.\r\n   * Note: locally defined items (with noMove property) still override this setting.\r\n   *\r\n   * @param doEnable if true widgets will be movable, if false moving is disabled\r\n   * @param recurse if true (default), sub-grids also get updated\r\n   * @returns the grid instance for chaining\r\n   *\r\n   * @example\r\n   * // Enable moving for all widgets\r\n   * grid.enableMove(true);\r\n   *\r\n   * // Disable moving for all widgets\r\n   * grid.enableMove(false);\r\n   *\r\n   * // Enable only this grid, not sub-grids\r\n   * grid.enableMove(true, false);\r\n   */\r\n  public enableMove(doEnable: boolean, recurse = true): GridStack {\r\n    if (this.opts.staticGrid) return this; // can't move a static grid!\r\n    doEnable ? delete this.opts.disableDrag : this.opts.disableDrag = true; // FIRST before we update children as grid overrides #1658\r\n    this.engine.nodes.forEach(n => {\r\n      this.prepareDragDrop(n.el);\r\n      if (n.subGrid && recurse) n.subGrid.enableMove(doEnable, recurse);\r\n    });\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * Enables/disables widget resizing for all widgets. No-op for static grids.\r\n   * Note: locally defined items (with noResize property) still override this setting.\r\n   *\r\n   * @param doEnable if true widgets will be resizable, if false resizing is disabled\r\n   * @param recurse if true (default), sub-grids also get updated\r\n   * @returns the grid instance for chaining\r\n   *\r\n   * @example\r\n   * // Enable resizing for all widgets\r\n   * grid.enableResize(true);\r\n   *\r\n   * // Disable resizing for all widgets\r\n   * grid.enableResize(false);\r\n   *\r\n   * // Enable only this grid, not sub-grids\r\n   * grid.enableResize(true, false);\r\n   */\r\n  public enableResize(doEnable: boolean, recurse = true): GridStack {\r\n    if (this.opts.staticGrid) return this; // can't size a static grid!\r\n    doEnable ? delete this.opts.disableResize : this.opts.disableResize = true; // FIRST before we update children as grid overrides #1658\r\n    this.engine.nodes.forEach(n => {\r\n      this.prepareDragDrop(n.el);\r\n      if (n.subGrid && recurse) n.subGrid.enableResize(doEnable, recurse);\r\n    });\r\n    return this;\r\n  }\r\n\r\n  /** @internal call when drag (and drop) needs to be cancelled (Esc key) */\r\n  public cancelDrag() {\r\n    const n = this._placeholder?.gridstackNode;\r\n    if (!n) return;\r\n    if (n._isExternal) {\r\n      // remove any newly inserted nodes (from outside)\r\n      n._isAboutToRemove = true;\r\n      this.engine.removeNode(n);\r\n    } else if (n._isAboutToRemove) {\r\n      // restore any temp removed (dragged over trash)\r\n      GridStack._itemRemoving(n.el, false);\r\n    }\r\n\r\n    this.engine.restoreInitial();\r\n  }\r\n\r\n  /** @internal removes any drag&drop present (called during destroy) */\r\n  protected _removeDD(el: DDElementHost): GridStack {\r\n    dd.draggable(el, 'destroy').resizable(el, 'destroy');\r\n    if (el.gridstackNode) {\r\n      delete el.gridstackNode._initDD; // reset our DD init flag\r\n    }\r\n    delete el.ddElement;\r\n    return this;\r\n  }\r\n\r\n  /** @internal called to add drag over to support widgets being added externally */\r\n  protected _setupAcceptWidget(): GridStack {\r\n\r\n    // check if we need to disable things\r\n    if (this.opts.staticGrid || (!this.opts.acceptWidgets && !this.opts.removable)) {\r\n      dd.droppable(this.el, 'destroy');\r\n      return this;\r\n    }\r\n\r\n    // vars shared across all methods\r\n    let cellHeight: number, cellWidth: number;\r\n\r\n    const onDrag = (event: DragEvent, el: GridItemHTMLElement, helper: GridItemHTMLElement) => {\r\n      helper = helper || el;\r\n      const node = helper.gridstackNode;\r\n      if (!node) return;\r\n\r\n      // if the element is being dragged from outside, scale it down to match the grid's scale\r\n      // and slightly adjust its position relative to the mouse\r\n      if (!node.grid?.el) {\r\n        // this scales the helper down\r\n        helper.style.transform = `scale(${1 / this.dragTransform.xScale},${1 / this.dragTransform.yScale})`;\r\n        // this makes it so that the helper is well positioned relative to the mouse after scaling\r\n        const helperRect = helper.getBoundingClientRect();\r\n        helper.style.left = helperRect.x + (this.dragTransform.xScale - 1) * (event.clientX - helperRect.x) / this.dragTransform.xScale + 'px';\r\n        helper.style.top = helperRect.y + (this.dragTransform.yScale - 1) * (event.clientY - helperRect.y) / this.dragTransform.yScale + 'px';\r\n        helper.style.transformOrigin = `0px 0px`\r\n      }\r\n\r\n      let { top, left } = helper.getBoundingClientRect();\r\n      const rect = this.el.getBoundingClientRect();\r\n      left -= rect.left;\r\n      top -= rect.top;\r\n      const ui: DDUIData = {\r\n        position: {\r\n          top: top * this.dragTransform.xScale,\r\n          left: left * this.dragTransform.yScale\r\n        }\r\n      };\r\n\r\n      if (node._temporaryRemoved) {\r\n        node.x = Math.max(0, Math.round(left / cellWidth));\r\n        node.y = Math.max(0, Math.round(top / cellHeight));\r\n        delete node.autoPosition;\r\n        this.engine.nodeBoundFix(node);\r\n\r\n        // don't accept *initial* location if doesn't fit #1419 (locked drop region, or can't grow), but maybe try if it will go somewhere\r\n        if (!this.engine.willItFit(node)) {\r\n          node.autoPosition = true; // ignore x,y and try for any slot...\r\n          if (!this.engine.willItFit(node)) {\r\n            dd.off(el, 'drag'); // stop calling us\r\n            return; // full grid or can't grow\r\n          }\r\n          if (node._willFitPos) {\r\n            // use the auto position instead #1687\r\n            Utils.copyPos(node, node._willFitPos);\r\n            delete node._willFitPos;\r\n          }\r\n        }\r\n\r\n        // re-use the existing node dragging method\r\n        this._onStartMoving(helper, event, ui, node, cellWidth, cellHeight);\r\n      } else {\r\n        // re-use the existing node dragging that does so much of the collision detection\r\n        this._dragOrResize(helper, event, ui, node, cellWidth, cellHeight);\r\n      }\r\n    }\r\n\r\n    dd.droppable(this.el, {\r\n      accept: (el: GridItemHTMLElement) => {\r\n        const node: GridStackNode = el.gridstackNode || this._readAttr(el, false);\r\n        // set accept drop to true on ourself (which we ignore) so we don't get \"can't drop\" icon in HTML5 mode while moving\r\n        if (node?.grid === this) return true;\r\n        if (!this.opts.acceptWidgets) return false;\r\n        // check for accept method or class matching\r\n        let canAccept = true;\r\n        if (typeof this.opts.acceptWidgets === 'function') {\r\n          canAccept = this.opts.acceptWidgets(el);\r\n        } else {\r\n          const selector = (this.opts.acceptWidgets === true ? '.grid-stack-item' : this.opts.acceptWidgets as string);\r\n          canAccept = el.matches(selector);\r\n        }\r\n        // finally check to make sure we actually have space left #1571 #2633\r\n        if (canAccept && node && this.opts.maxRow) {\r\n          const n = { w: node.w, h: node.h, minW: node.minW, minH: node.minH }; // only width/height matters and autoPosition\r\n          canAccept = this.engine.willItFit(n);\r\n        }\r\n        return canAccept;\r\n      }\r\n    })\r\n      /**\r\n       * entering our grid area\r\n       */\r\n      .on(this.el, 'dropover', (event: Event, el: GridItemHTMLElement, helper: GridItemHTMLElement) => {\r\n        // console.log(`over ${this.el.gridstack.opts.id} ${count++}`); // TEST\r\n        let node = helper?.gridstackNode || el.gridstackNode;\r\n        // ignore drop enter on ourself (unless we temporarily removed) which happens on a simple drag of our item\r\n        if (node?.grid === this && !node._temporaryRemoved) {\r\n          // delete node._added; // reset this to track placeholder again in case we were over other grid #1484 (dropout doesn't always clear)\r\n          return false; // prevent parent from receiving msg (which may be a grid as well)\r\n        }\r\n\r\n        // If sidebar item, restore the sidebar node size to ensure consistent behavior when dragging between grids\r\n        if (node?._sidebarOrig) {\r\n          node.w = node._sidebarOrig.w;\r\n          node.h = node._sidebarOrig.h;\r\n        }\r\n\r\n        // fix #1578 when dragging fast, we may not get a leave on the previous grid so force one now\r\n        if (node?.grid && node.grid !== this && !node._temporaryRemoved) {\r\n          // console.log('dropover without leave'); // TEST\r\n          const otherGrid = node.grid;\r\n          otherGrid._leave(el, helper);\r\n        }\r\n        helper = helper || el;\r\n\r\n        // cache cell dimensions (which don't change), position can animate if we removed an item in otherGrid that affects us...\r\n        cellWidth = this.cellWidth();\r\n        cellHeight = this.getCellHeight(true);\r\n\r\n        // sidebar items: load any element attributes if we don't have a node on first enter from the sidebar\r\n        if (!node) {\r\n          const attr = helper.getAttribute('data-gs-widget') || helper.getAttribute('gridstacknode'); // TBD: temp support for old V11.0.0 attribute\r\n          if (attr) {\r\n            try {\r\n              node = JSON.parse(attr);\r\n            } catch (error) {\r\n              console.error(\"Gridstack dropover: Bad JSON format: \", attr);\r\n            }\r\n            helper.removeAttribute('data-gs-widget');\r\n            helper.removeAttribute('gridstacknode');\r\n          }\r\n          if (!node) node = this._readAttr(helper); // used to pass false for #2354, but now we clone top level node\r\n          // On first grid enter from sidebar, set the initial sidebar item size properties for the node\r\n          node._sidebarOrig = { w: node.w, h: node.h }\r\n        }\r\n        if (!node.grid) { // sidebar item\r\n          if (!node.el) node = {...node}; // clone first time we're coming from sidebar (since 'clone' doesn't copy vars)\r\n          node._isExternal = true;\r\n          helper.gridstackNode = node;\r\n        }\r\n\r\n        // calculate the grid size based on element outer size\r\n        const w = node.w || Math.round(helper.offsetWidth / cellWidth) || 1;\r\n        const h = node.h || Math.round(helper.offsetHeight / cellHeight) || 1;\r\n\r\n        // if the item came from another grid, make a copy and save the original info in case we go back there\r\n        if (node.grid && node.grid !== this) {\r\n          // copy the node original values (min/max/id/etc...) but override width/height/other flags which are this grid specific\r\n          // console.log('dropover cloning node'); // TEST\r\n          if (!el._gridstackNodeOrig) el._gridstackNodeOrig = node; // shouldn't have multiple nested!\r\n          el.gridstackNode = node = { ...node, w, h, grid: this };\r\n          delete node.x;\r\n          delete node.y;\r\n          this.engine.cleanupNode(node)\r\n            .nodeBoundFix(node);\r\n          // restore some internal fields we need after clearing them all\r\n          node._initDD =\r\n            node._isExternal =  // DOM needs to be re-parented on a drop\r\n            node._temporaryRemoved = true; // so it can be inserted onDrag below\r\n        } else {\r\n          node.w = w;\r\n          node.h = h;\r\n          node._temporaryRemoved = true; // so we can insert it\r\n        }\r\n\r\n        // clear any marked for complete removal (Note: don't check _isAboutToRemove as that is cleared above - just do it)\r\n        GridStack._itemRemoving(node.el, false);\r\n\r\n        dd.on(el, 'drag', onDrag);\r\n        // make sure this is called at least once when going fast #1578\r\n        onDrag(event as DragEvent, el, helper);\r\n        return false; // prevent parent from receiving msg (which may be a grid as well)\r\n      })\r\n      /**\r\n       * Leaving our grid area...\r\n       */\r\n      .on(this.el, 'dropout', (event, el: GridItemHTMLElement, helper: GridItemHTMLElement) => {\r\n        // console.log(`out ${this.el.gridstack.opts.id} ${count++}`); // TEST\r\n        const node = helper?.gridstackNode || el.gridstackNode;\r\n        if (!node) return false;\r\n        // fix #1578 when dragging fast, we might get leave after other grid gets enter (which calls us to clean)\r\n        // so skip this one if we're not the active grid really..\r\n        if (!node.grid || node.grid === this) {\r\n          this._leave(el, helper);\r\n          // if we were created as temporary nested grid, go back to before state\r\n          if (this._isTemp) {\r\n            this.removeAsSubGrid(node);\r\n          }\r\n        }\r\n        return false; // prevent parent from receiving msg (which may be grid as well)\r\n      })\r\n      /**\r\n       * end - releasing the mouse\r\n       */\r\n      .on(this.el, 'drop', (event, el: GridItemHTMLElement, helper: GridItemHTMLElement) => {\r\n        const node = helper?.gridstackNode || el.gridstackNode;\r\n        // ignore drop on ourself from ourself that didn't come from the outside - dragend will handle the simple move instead\r\n        if (node?.grid === this && !node._isExternal) return false;\r\n\r\n        const wasAdded = !!this.placeholder.parentElement; // skip items not actually added to us because of constrains, but do cleanup #1419\r\n        const wasSidebar = el !== helper;\r\n        this.placeholder.remove();\r\n        delete this.placeholder.gridstackNode;\r\n\r\n        // disable animation when replacing a placeholder (already positioned) with actual content\r\n        if (wasAdded && this.opts.animate) {\r\n          this.setAnimation(false);\r\n          this.setAnimation(true, true); // delay adding back\r\n        }\r\n\r\n        // notify previous grid of removal\r\n        // console.log('drop delete _gridstackNodeOrig') // TEST\r\n        const origNode = el._gridstackNodeOrig;\r\n        delete el._gridstackNodeOrig;\r\n        if (wasAdded && origNode?.grid && origNode.grid !== this) {\r\n          const oGrid = origNode.grid;\r\n          oGrid.engine.removeNodeFromLayoutCache(origNode);\r\n          oGrid.engine.removedNodes.push(origNode);\r\n          oGrid._triggerRemoveEvent()._triggerChangeEvent();\r\n          // if it's an empty sub-grid that got auto-created, nuke it\r\n          if (oGrid.parentGridNode && !oGrid.engine.nodes.length && oGrid.opts.subGridDynamic) {\r\n            oGrid.removeAsSubGrid();\r\n          }\r\n        }\r\n\r\n        if (!node) return false;\r\n\r\n        // use existing placeholder node as it's already in our list with drop location\r\n        if (wasAdded) {\r\n          this.engine.cleanupNode(node); // removes all internal _xyz values\r\n          node.grid = this;\r\n        }\r\n        delete node.grid?._isTemp;\r\n        dd.off(el, 'drag');\r\n        // if we made a copy insert that instead of the original (sidebar item)\r\n        if (helper !== el) {\r\n          helper.remove();\r\n          el = helper;\r\n        } else {\r\n          el.remove(); // reduce flicker as we change depth here, and size further down\r\n        }\r\n        this._removeDD(el);\r\n        if (!wasAdded) return false;\r\n        const subGrid = node.subGrid?.el?.gridstack; // set when actual sub-grid present\r\n        Utils.copyPos(node, this._readAttr(this.placeholder)); // placeholder values as moving VERY fast can throw things off #1578\r\n        Utils.removePositioningStyles(el);\r\n\r\n        // give the user a chance to alter the widget that will get inserted if new sidebar item\r\n        if (wasSidebar && (node.content || node.subGridOpts || GridStack.addRemoveCB)) {\r\n          delete node.el;\r\n          el = this.addWidget(node);\r\n        } else {\r\n          this._prepareElement(el, true, node);\r\n          this.el.appendChild(el);\r\n          // resizeToContent is skipped in _prepareElement() until node is visible (clientHeight=0) so call it now\r\n          this.resizeToContentCheck(false, node);\r\n          if (subGrid) {\r\n            subGrid.parentGridNode = node;\r\n          }\r\n          this._updateContainerHeight();\r\n        }\r\n        this.engine.addedNodes.push(node);\r\n        this._triggerAddEvent();\r\n        this._triggerChangeEvent();\r\n\r\n        this.engine.endUpdate();\r\n        if (this._gsEventHandler['dropped']) {\r\n          this._gsEventHandler['dropped']({ ...event, type: 'dropped' }, origNode && origNode.grid ? origNode : undefined, node);\r\n        }\r\n\r\n        return false; // prevent parent from receiving msg (which may be grid as well)\r\n      });\r\n    return this;\r\n  }\r\n\r\n  /** @internal mark item for removal */\r\n  private static _itemRemoving(el: GridItemHTMLElement, remove: boolean) {\r\n    if (!el) return;\r\n    const node = el ? el.gridstackNode : undefined;\r\n    if (!node?.grid || el.classList.contains(node.grid.opts.removableOptions.decline)) return;\r\n    remove ? node._isAboutToRemove = true : delete node._isAboutToRemove;\r\n    remove ? el.classList.add('grid-stack-item-removing') : el.classList.remove('grid-stack-item-removing');\r\n  }\r\n\r\n  /** @internal called to setup a trash drop zone if the user specifies it */\r\n  protected _setupRemoveDrop(): GridStack {\r\n    if (typeof this.opts.removable !== 'string') return this;\r\n    const trashEl = document.querySelector(this.opts.removable) as HTMLElement;\r\n    if (!trashEl) return this;\r\n\r\n    // only register ONE static drop-over/dropout callback for the 'trash', and it will\r\n    // update the passed in item and parent grid because the '.trash' is a shared resource anyway,\r\n    // and Native DD only has 1 event CB (having a list and technically a per grid removableOptions complicates things greatly)\r\n    if (!this.opts.staticGrid && !dd.isDroppable(trashEl)) {\r\n      dd.droppable(trashEl, this.opts.removableOptions)\r\n        .on(trashEl, 'dropover', (event, el) => GridStack._itemRemoving(el, true))\r\n        .on(trashEl, 'dropout', (event, el) => GridStack._itemRemoving(el, false));\r\n    }\r\n    return this;\r\n  }\r\n\r\n  /**\r\n   * prepares the element for drag&drop - this is normally called by makeWidget() unless are are delay loading\r\n   * @param el GridItemHTMLElement of the widget\r\n   * @param [force=false]\r\n   * */\r\n  public prepareDragDrop(el: GridItemHTMLElement, force = false): GridStack {\r\n    const node = el?.gridstackNode;\r\n    if (!node) return;\r\n    const noMove = node.noMove || this.opts.disableDrag;\r\n    const noResize = node.noResize || this.opts.disableResize;\r\n\r\n    // check for disabled grid first\r\n    const disable = this.opts.staticGrid || (noMove && noResize);\r\n    if (force || disable) {\r\n      if (node._initDD) {\r\n        this._removeDD(el); // nukes everything instead of just disable, will add some styles back next\r\n        delete node._initDD;\r\n      }\r\n      if (disable) el.classList.add('ui-draggable-disabled', 'ui-resizable-disabled'); // add styles one might depend on #1435\r\n      if (!force) return this;\r\n    }\r\n\r\n    if (!node._initDD) {\r\n      // variables used/cashed between the 3 start/move/end methods, in addition to node passed above\r\n      let cellWidth: number;\r\n      let cellHeight: number;\r\n\r\n      /** called when item starts moving/resizing */\r\n      const onStartMoving = (event: Event, ui: DDUIData) => {\r\n        // trigger any 'dragstart' / 'resizestart' manually\r\n        this.triggerEvent(event, event.target as GridItemHTMLElement);\r\n        cellWidth = this.cellWidth();\r\n        cellHeight = this.getCellHeight(true); // force pixels for calculations\r\n\r\n        this._onStartMoving(el, event, ui, node, cellWidth, cellHeight);\r\n      }\r\n\r\n      /** called when item is being dragged/resized */\r\n      const dragOrResize = (event: MouseEvent, ui: DDUIData) => {\r\n        this._dragOrResize(el, event, ui, node, cellWidth, cellHeight);\r\n      }\r\n\r\n      /** called when the item stops moving/resizing */\r\n      const onEndMoving = (event: Event) => {\r\n        this.placeholder.remove();\r\n        delete this.placeholder.gridstackNode;\r\n        delete node._moving;\r\n        delete node._resizing;\r\n        delete node._event;\r\n        delete node._lastTried;\r\n        const widthChanged = node.w !== node._orig.w;\r\n\r\n        // if the item has moved to another grid, we're done here\r\n        const target: GridItemHTMLElement = event.target as GridItemHTMLElement;\r\n        if (!target.gridstackNode || target.gridstackNode.grid !== this) return;\r\n\r\n        node.el = target;\r\n\r\n        if (node._isAboutToRemove) {\r\n          const grid = el.gridstackNode.grid;\r\n          if (grid._gsEventHandler[event.type]) {\r\n            grid._gsEventHandler[event.type](event, target);\r\n          }\r\n          grid.engine.nodes.push(node); // temp add it back so we can proper remove it next\r\n          grid.removeWidget(el, true, true);\r\n        } else {\r\n          Utils.removePositioningStyles(target);\r\n          if (node._temporaryRemoved) {\r\n            // use last position we were at (not _orig as we may have pushed others and moved) and add it back\r\n            this._writePosAttr(target, node);\r\n            this.engine.addNode(node);\r\n          } else {\r\n            // move to new placeholder location\r\n            this._writePosAttr(target, node);\r\n          }\r\n          this.triggerEvent(event, target);\r\n        }\r\n        // @ts-ignore\r\n        this._extraDragRow = 0;// @ts-ignore\r\n        this._updateContainerHeight();// @ts-ignore\r\n        this._triggerChangeEvent();\r\n\r\n        this.engine.endUpdate();\r\n\r\n        if (event.type === 'resizestop') {\r\n          if (Number.isInteger(node.sizeToContent)) node.sizeToContent = node.h; // new soft limit\r\n          this.resizeToContentCheck(widthChanged, node); // wait for width animation if changed\r\n        }\r\n      }\r\n\r\n      dd.draggable(el, {\r\n        start: onStartMoving,\r\n        stop: onEndMoving,\r\n        drag: dragOrResize\r\n      }).resizable(el, {\r\n        start: onStartMoving,\r\n        stop: onEndMoving,\r\n        resize: dragOrResize\r\n      });\r\n      node._initDD = true; // we've set DD support now\r\n    }\r\n\r\n    // finally fine tune move vs resize by disabling any part...\r\n    dd.draggable(el, noMove ? 'disable' : 'enable')\r\n      .resizable(el, noResize ? 'disable' : 'enable');\r\n\r\n    return this;\r\n  }\r\n\r\n  /** @internal handles actual drag/resize start */\r\n  protected _onStartMoving(el: GridItemHTMLElement, event: Event, ui: DDUIData, node: GridStackNode, cellWidth: number, cellHeight: number): void {\r\n    this.engine.cleanNodes()\r\n      .beginUpdate(node);\r\n    // @ts-ignore\r\n    this._writePosAttr(this.placeholder, node)\r\n    this.el.appendChild(this.placeholder);\r\n    this.placeholder.gridstackNode = node;\r\n    // console.log('_onStartMoving placeholder') // TEST\r\n\r\n    // if the element is inside a grid, it has already been scaled\r\n    // we can use that as a scale reference\r\n    if (node.grid?.el) {\r\n      this.dragTransform = Utils.getValuesFromTransformedElement(el);\r\n    }\r\n    // if the element is being dragged from outside (not from any grid)\r\n    // we use the grid as the transformation reference, since the helper is not subject to transformation\r\n    else if (this.placeholder && this.placeholder.closest('.grid-stack')) {\r\n      const gridEl = this.placeholder.closest('.grid-stack') as HTMLElement;\r\n      this.dragTransform = Utils.getValuesFromTransformedElement(gridEl);\r\n    }\r\n    // Fallback\r\n    else {\r\n      this.dragTransform = {\r\n        xScale: 1,\r\n        xOffset: 0,\r\n        yScale: 1,\r\n        yOffset: 0,\r\n      }\r\n    }\r\n\r\n    node.el = this.placeholder;\r\n    node._lastUiPosition = ui.position;\r\n    node._prevYPix = ui.position.top;\r\n    node._moving = (event.type === 'dragstart'); // 'dropover' are not initially moving so they can go exactly where they enter (will push stuff out of the way)\r\n    node._resizing = (event.type === 'resizestart');\r\n    delete node._lastTried;\r\n\r\n    if (event.type === 'dropover' && node._temporaryRemoved) {\r\n      // console.log('engine.addNode x=' + node.x); // TEST\r\n      this.engine.addNode(node); // will add, fix collisions, update attr and clear _temporaryRemoved\r\n      node._moving = true; // AFTER, mark as moving object (wanted fix location before)\r\n    }\r\n\r\n    // set the min/max resize info taking into account the column count and position (so we don't resize outside the grid)\r\n    this.engine.cacheRects(cellWidth, cellHeight, this.opts.marginTop as number, this.opts.marginRight as number, this.opts.marginBottom as number, this.opts.marginLeft as number);\r\n    if (event.type === 'resizestart') {\r\n      const colLeft = this.getColumn() - node.x;\r\n      const rowLeft = (this.opts.maxRow || Number.MAX_SAFE_INTEGER) - node.y;\r\n      dd.resizable(el, 'option', 'minWidth', cellWidth * Math.min(node.minW || 1, colLeft))\r\n        .resizable(el, 'option', 'minHeight', cellHeight * Math.min(node.minH || 1, rowLeft))\r\n        .resizable(el, 'option', 'maxWidth', cellWidth * Math.min(node.maxW || Number.MAX_SAFE_INTEGER, colLeft))\r\n        .resizable(el, 'option', 'maxWidthMoveLeft', cellWidth * Math.min(node.maxW || Number.MAX_SAFE_INTEGER, node.x+node.w))\r\n        .resizable(el, 'option', 'maxHeight', cellHeight * Math.min(node.maxH || Number.MAX_SAFE_INTEGER, rowLeft))\r\n        .resizable(el, 'option', 'maxHeightMoveUp', cellHeight * Math.min(node.maxH || Number.MAX_SAFE_INTEGER, node.y+node.h));\r\n    }\r\n  }\r\n\r\n  /** @internal handles actual drag/resize */\r\n  protected _dragOrResize(el: GridItemHTMLElement, event: GridStackMouseEvent, ui: DDUIData, node: GridStackNode, cellWidth: number, cellHeight: number): void {\r\n    const p = { ...node._orig }; // could be undefined (_isExternal) which is ok (drag only set x,y and w,h will default to node value)\r\n    let resizing: boolean;\r\n    let mLeft = this.opts.marginLeft as number,\r\n      mRight = this.opts.marginRight as number,\r\n      mTop = this.opts.marginTop as number,\r\n      mBottom = this.opts.marginBottom as number;\r\n\r\n    // if margins (which are used to pass mid point by) are large relative to cell height/width, reduce them down #1855\r\n    const mHeight = Math.round(cellHeight * 0.1),\r\n      mWidth = Math.round(cellWidth * 0.1);\r\n    mLeft = Math.min(mLeft, mWidth);\r\n    mRight = Math.min(mRight, mWidth);\r\n    mTop = Math.min(mTop, mHeight);\r\n    mBottom = Math.min(mBottom, mHeight);\r\n\r\n    if (event.type === 'drag') {\r\n      if (node._temporaryRemoved) return; // handled by dropover\r\n      const distance = ui.position.top - node._prevYPix;\r\n      node._prevYPix = ui.position.top;\r\n      if (this.opts.draggable.scroll !== false) {\r\n        Utils.updateScrollPosition(el, ui.position, distance);\r\n      }\r\n\r\n      // get new position taking into account the margin in the direction we are moving! (need to pass mid point by margin)\r\n      const left = ui.position.left + (ui.position.left > node._lastUiPosition.left ? -mRight : mLeft);\r\n      const top = ui.position.top + (ui.position.top > node._lastUiPosition.top ? -mBottom : mTop);\r\n      p.x = Math.round(left / cellWidth);\r\n      p.y = Math.round(top / cellHeight);\r\n\r\n      // @ts-ignore// if we're at the bottom hitting something else, grow the grid so cursor doesn't leave when trying to place below others\r\n      const prev = this._extraDragRow;\r\n      if (this.engine.collide(node, p)) {\r\n        const row = this.getRow();\r\n        let extra = Math.max(0, (p.y + node.h) - row);\r\n        if (this.opts.maxRow && row + extra > this.opts.maxRow) {\r\n          extra = Math.max(0, this.opts.maxRow - row);\r\n        }// @ts-ignore\r\n        this._extraDragRow = extra;// @ts-ignore\r\n      } else this._extraDragRow = 0;// @ts-ignore\r\n      if (this._extraDragRow !== prev) this._updateContainerHeight();\r\n\r\n      if (node.x === p.x && node.y === p.y) return; // skip same\r\n      // DON'T skip one we tried as we might have failed because of coverage <50% before\r\n      // if (node._lastTried && node._lastTried.x === x && node._lastTried.y === y) return;\r\n    } else if (event.type === 'resize') {\r\n      if (p.x < 0) return;\r\n      // Scrolling page if needed\r\n      Utils.updateScrollResize(event, el, cellHeight);\r\n\r\n      // get new size\r\n      p.w = Math.round((ui.size.width - mLeft) / cellWidth);\r\n      p.h = Math.round((ui.size.height - mTop) / cellHeight);\r\n      if (node.w === p.w && node.h === p.h) return;\r\n      if (node._lastTried && node._lastTried.w === p.w && node._lastTried.h === p.h) return; // skip one we tried (but failed)\r\n\r\n      // only recalculate position for handles that move the top-left corner (N/W).\r\n      // for SE/S/E handles the top-left is anchored — recalculating from pixels causes\r\n      // rounding drift on fine grids where cellWidth/cellHeight are only a few pixels. #385 #1356\r\n      const dir = event.resizeDir;\r\n      if (dir && (dir.includes('w') || dir.includes('n'))) {\r\n        const left = ui.position.left + mLeft;\r\n        const top = ui.position.top + mTop;\r\n        if (dir.includes('w')) p.x = Math.round(left / cellWidth);\r\n        if (dir.includes('n')) p.y = Math.round(top / cellHeight);\r\n      }\r\n\r\n      resizing = true;\r\n    }\r\n\r\n    node._event = event;\r\n    node._lastTried = p; // set as last tried (will nuke if we go there)\r\n    const rect: GridStackPosition = { // screen pix of the dragged box\r\n      x: ui.position.left + mLeft,\r\n      y: ui.position.top + mTop,\r\n      w: (ui.size ? ui.size.width : node.w * cellWidth) - mLeft - mRight,\r\n      h: (ui.size ? ui.size.height : node.h * cellHeight) - mTop - mBottom\r\n    };\r\n    if (this.engine.moveNodeCheck(node, { ...p, cellWidth, cellHeight, rect, resizing })) {\r\n      node._lastUiPosition = ui.position;\r\n      this.engine.cacheRects(cellWidth, cellHeight, mTop, mRight, mBottom, mLeft);\r\n      delete node._skipDown;\r\n      if (resizing && node.subGrid) node.subGrid.onResize();\r\n      this._extraDragRow = 0;// @ts-ignore\r\n      this._updateContainerHeight();\r\n\r\n      const target = event.target as GridItemHTMLElement;// @ts-ignore\r\n      // Do not write sidebar item attributes back to the original sidebar el\r\n      if (!node._sidebarOrig) {\r\n        this._writePosAttr(target, node);\r\n      }\r\n      this.triggerEvent(event, target);\r\n    }\r\n  }\r\n\r\n  /** call given event callback on our main top-most grid (if we're nested) */\r\n  protected triggerEvent(event: Event, target: GridItemHTMLElement) {\r\n    // eslint-disable-next-line @typescript-eslint/no-this-alias\r\n    let grid: GridStack = this;\r\n    while (grid.parentGridNode) grid = grid.parentGridNode.grid;\r\n    if (grid._gsEventHandler[event.type]) {\r\n      grid._gsEventHandler[event.type](event, target);\r\n    }\r\n  }\r\n\r\n  /** @internal called when item leaving our area by either cursor dropout event\r\n   * or shape is outside our boundaries. remove it from us, and mark temporary if this was\r\n   * our item to start with else restore prev node values from prev grid it came from.\r\n   */\r\n  protected _leave(el: GridItemHTMLElement, helper?: GridItemHTMLElement): void {\r\n    helper = helper || el;\r\n    const node = helper.gridstackNode;\r\n    if (!node) return;\r\n\r\n    // remove the scale of the helper on leave\r\n    helper.style.transform = helper.style.transformOrigin = null;\r\n    dd.off(el, 'drag'); // no need to track while being outside\r\n\r\n    // this gets called when cursor leaves and shape is outside, so only do this once\r\n    if (node._temporaryRemoved) return;\r\n    node._temporaryRemoved = true;\r\n\r\n    this.engine.removeNode(node); // remove placeholder as well, otherwise it's a sign node is not in our list, which is a bigger issue\r\n    node.el = node._isExternal && helper ? helper : el; // point back to real item being dragged\r\n    const sidebarOrig = node._sidebarOrig;\r\n    if (node._isExternal) this.engine.cleanupNode(node);\r\n    // Restore sidebar item initial size info to stay consistent when dragging between multiple grids\r\n    node._sidebarOrig = sidebarOrig;\r\n\r\n    if (this.opts.removable === true) { // boolean vs a class string\r\n      // item leaving us and we are supposed to remove on leave (no need to drag onto trash) mark it so\r\n      GridStack._itemRemoving(el, true);\r\n    }\r\n\r\n    // finally if item originally came from another grid, but left us, restore things back to prev info\r\n    if (el._gridstackNodeOrig) {\r\n      // console.log('leave delete _gridstackNodeOrig') // TEST\r\n      el.gridstackNode = el._gridstackNodeOrig;\r\n      delete el._gridstackNodeOrig;\r\n    } else if (node._isExternal) {\r\n      // item came from outside restore all nodes back to original\r\n      this.engine.restoreInitial();\r\n    }\r\n  }\r\n}\r\n"
  },
  {
    "path": "src/types.ts",
    "content": "/**\r\n * types.ts 12.4.3\r\n * Copyright (c) 2021-2025 Alain Dumesny - see GridStack root license\r\n */\r\n\r\nimport { GridStack } from './gridstack';\r\nimport { GridStackEngine } from './gridstack-engine';\r\n\r\n/**\r\n * Default values for grid options - used during initialization and when saving out grid configuration.\r\n * These values are applied when options are not explicitly provided.\r\n */\r\nexport const gridDefaults: GridStackOptions = {\r\n  alwaysShowResizeHandle: 'mobile',\r\n  animate: true,\r\n  auto: true,\r\n  cellHeight: 'auto',\r\n  cellHeightThrottle: 100,\r\n  cellHeightUnit: 'px',\r\n  column: 12,\r\n  draggable: { handle: '.grid-stack-item-content', appendTo: 'body', scroll: true },\r\n  handle: '.grid-stack-item-content',\r\n  itemClass: 'grid-stack-item',\r\n  margin: 10,\r\n  marginUnit: 'px',\r\n  maxRow: 0,\r\n  minRow: 0,\r\n  placeholderClass: 'grid-stack-placeholder',\r\n  placeholderText: '',\r\n  removableOptions: { accept: 'grid-stack-item', decline: 'grid-stack-non-removable'},\r\n  resizable: { handles: 'se' },\r\n  rtl: 'auto',\r\n\r\n  // **** same as not being set ****\r\n  // disableDrag: false,\r\n  // disableResize: false,\r\n  // float: false,\r\n  // handleClass: null,\r\n  // removable: false,\r\n  // staticGrid: false,\r\n  //removable\r\n};\r\n\r\n/**\r\n * Different layout options when changing the number of columns.\r\n *\r\n * These options control how widgets are repositioned when the grid column count changes.\r\n * Note: The new list may be partially filled if there's a cached layout for that size.\r\n *\r\n * Options:\r\n * - `'list'`: Treat items as a sorted list, keeping them sequentially without resizing (unless too big)\r\n * - `'compact'`: Similar to list, but uses compact() method to fill empty slots by reordering\r\n * - `'moveScale'`: Scale and move items by the ratio of newColumnCount / oldColumnCount\r\n * - `'move'`: Only move items, keep their sizes\r\n * - `'scale'`: Only scale items, keep their positions\r\n * - `'none'`: Leave items unchanged unless they don't fit in the new column count\r\n * - Custom function: Provide your own layout logic\r\n */\r\nexport type ColumnOptions = 'list' | 'compact' | 'moveScale' | 'move' | 'scale' | 'none' |\r\n  ((column: number, oldColumn: number, nodes: GridStackNode[], oldNodes: GridStackNode[]) => void);\r\n/**\r\n * Options for the compact() method to reclaim empty space.\r\n * - `'list'`: Keep items in order, move them up sequentially\r\n * - `'compact'`: Find truly empty spaces, may reorder items for optimal fit\r\n */\r\nexport type CompactOptions = 'list' | 'compact';\r\n/**\r\n * Type representing values that can be either numbers or strings (e.g., dimensions with units).\r\n * Used for properties like width, height, margins that accept both numeric and string values.\r\n */\r\nexport type numberOrString = number | string;\r\n/**\r\n * Extended HTMLElement interface for grid items.\r\n * All grid item DOM elements implement this interface to provide access to their grid data.\r\n */\r\nexport interface GridItemHTMLElement extends HTMLElement {\r\n  /** Pointer to the associated grid node instance containing position, size, and other widget data */\r\n  gridstackNode?: GridStackNode;\r\n  /** @internal Original node data (used for restoring during drag operations) */\r\n  _gridstackNodeOrig?: GridStackNode;\r\n}\r\n\r\n/**\r\n * Type representing various ways to specify grid elements.\r\n * Can be a CSS selector string, GridItemHTMLElement (HTML element with GS variables when loaded).\r\n */\r\nexport type GridStackElement = string | GridItemHTMLElement;\r\n\r\n/**\r\n * Event handler function types for the .on() method.\r\n * Different handlers receive different parameters based on the event type.\r\n */\r\n\r\n/** General event handler that receives only the event */\r\nexport type GridStackEventHandler = (event: Event) => void;\r\n\r\n/** Element-specific event handler that receives event and affected element */\r\nexport type GridStackElementHandler = (event: Event, el: GridItemHTMLElement) => void;\r\n\r\n/** Node-based event handler that receives event and array of affected nodes */\r\nexport type GridStackNodesHandler = (event: Event, nodes: GridStackNode[]) => void;\r\n\r\n/** Drop event handler that receives previous and new node states */\r\nexport type GridStackDroppedHandler = (event: Event, previousNode: GridStackNode, newNode: GridStackNode) => void;\r\n\r\n/** Union type of all possible event handler types */\r\nexport type GridStackEventHandlerCallback = GridStackEventHandler | GridStackElementHandler | GridStackNodesHandler | GridStackDroppedHandler;\r\n\r\n/**\r\n * Optional callback function called during load() operations.\r\n * Allows custom handling of widget addition/removal for framework integration.\r\n *\r\n * @param parent - The parent HTML element\r\n * @param w - The widget definition\r\n * @param add - True if adding, false if removing\r\n * @param grid - True if this is a grid operation\r\n * @returns The created/modified HTML element, or undefined\r\n */\r\nexport type AddRemoveFcn = (parent: HTMLElement, w: GridStackWidget, add: boolean, grid: boolean) => HTMLElement | undefined;\r\n\r\n/**\r\n * Optional callback function called during save() operations.\r\n * Allows adding custom data to the saved widget structure.\r\n *\r\n * @param node - The internal grid node\r\n * @param w - The widget structure being saved (can be modified)\r\n */\r\nexport type SaveFcn = (node: GridStackNode, w: GridStackWidget) => void;\r\n\r\n/**\r\n * Optional callback function for custom widget content rendering.\r\n * Called during load()/addWidget() to create custom content beyond plain text.\r\n *\r\n * @param el - The widget's content container element\r\n * @param w - The widget definition with content and other properties\r\n */\r\nexport type RenderFcn = (el: HTMLElement, w: GridStackWidget) => void;\r\n\r\n/**\r\n * Optional callback function for custom resize-to-content behavior.\r\n * Called when a widget needs to resize to fit its content.\r\n *\r\n * @param el - The grid item element to resize\r\n */\r\nexport type ResizeToContentFcn = (el: GridItemHTMLElement) => void;\r\n\r\n/**\r\n * Configuration for responsive grid behavior.\r\n *\r\n * Defines how the grid responds to different screen sizes by changing column counts.\r\n * NOTE: Make sure to include the appropriate CSS (gridstack-extra.css) to support responsive behavior.\r\n */\r\nexport interface Responsive {\r\n  /** wanted width to maintain (+-50%) to dynamically pick a column count. NOTE: make sure to have correct extra CSS to support this. */\r\n  columnWidth?: number;\r\n  /** maximum number of columns allowed (default: 12). NOTE: make sure to have correct extra CSS to support this. */\r\n  columnMax?: number;\r\n  /** explicit width:column breakpoints instead of automatic 'columnWidth'. NOTE: make sure to have correct extra CSS to support this. */\r\n  breakpoints?: Breakpoint[];\r\n  /** specify if breakpoints are for window size or grid size (default:false = grid) */\r\n  breakpointForWindow?: boolean;\r\n  /** global re-layout mode when changing columns */\r\n  layout?: ColumnOptions;\r\n}\r\n\r\n/**\r\n * Defines a responsive breakpoint for automatic column count changes.\r\n * Used with the responsive.breakpoints option.\r\n */\r\nexport interface Breakpoint {\r\n  /** Maximum width (in pixels) for this breakpoint to be active */\r\n  w?: number;\r\n  /** Number of columns to use when this breakpoint is active */\r\n  c: number;\r\n  /** Layout mode for this specific breakpoint (overrides global responsive.layout) */\r\n  layout?: ColumnOptions;\r\n  /** TODO: Future feature - specific children layout for this breakpoint */\r\n  // children?: GridStackWidget[];\r\n}\r\n\r\n/**\r\n * Defines the options for a Grid\r\n */\r\nexport interface GridStackOptions {\r\n  /**\r\n   * Accept widgets dragged from other grids or from outside (default: `false`). Can be:\r\n   * - `true`: will accept HTML elements having 'grid-stack-item' as class attribute\r\n   * - `false`: will not accept any external widgets\r\n   * - string: explicit class name to accept instead of default\r\n   * - function: callback called before an item will be accepted when entering a grid\r\n   *\r\n   * @example\r\n   * // Accept all grid items\r\n   * acceptWidgets: true\r\n   *\r\n   * // Accept only items with specific class\r\n   * acceptWidgets: 'my-draggable-item'\r\n   *\r\n   * // Custom validation function\r\n   * acceptWidgets: (el) => {\r\n   *   return el.getAttribute('data-accept') === 'true';\r\n   * }\r\n   *\r\n   * @see {@link http://gridstack.github.io/gridstack.js/demo/two.html} for complete example\r\n   */\r\n  acceptWidgets?: boolean | string | ((element: Element) => boolean);\r\n\r\n  /** possible values (default: `mobile`) - does not apply to non-resizable widgets\r\n    * `false` the resizing handles are only shown while hovering over a widget\r\n    * `true` the resizing handles are always shown\r\n    * 'mobile' if running on a mobile device, default to `true` (since there is no hovering per say), else `false`.\r\n    See [example](http://gridstack.github.io/gridstack.js/demo/mobile.html) */\r\n  alwaysShowResizeHandle?: true | false | 'mobile';\r\n\r\n  /** turns animation on (default?: true) */\r\n  animate?: boolean;\r\n\r\n  /** if false gridstack will not initialize existing items (default?: true) */\r\n  auto?: boolean;\r\n\r\n  /**\r\n   * One cell height (default: 'auto'). Can be:\r\n   * - an integer (px): fixed pixel height\r\n   * - a string (ex: '100px', '10em', '10rem'): CSS length value\r\n   * - 0: library will not generate styles for rows (define your own CSS)\r\n   * - 'auto': height calculated for square cells (width / column) and updated live on window resize\r\n   * - 'initial': similar to 'auto' but stays fixed size during window resizing\r\n   *\r\n   * Note: % values don't work correctly - see demo/cell-height.html\r\n   *\r\n   * @example\r\n   * // Fixed 100px height\r\n   * cellHeight: 100\r\n   *\r\n   * // CSS units\r\n   * cellHeight: '5rem'\r\n   * cellHeight: '100px'\r\n   *\r\n   * // Auto-sizing for square cells\r\n   * cellHeight: 'auto'\r\n   *\r\n   * // No CSS generation (custom styles)\r\n   * cellHeight: 0\r\n   */\r\n  cellHeight?: numberOrString;\r\n\r\n  /** throttle time delay (in ms) used when cellHeight='auto' to improve performance vs usability (default?: 100).\r\n   * A value of 0 will make it instant at a cost of re-creating the CSS file at ever window resize event!\r\n   * */\r\n  cellHeightThrottle?: number;\r\n\r\n  /** (internal) unit for cellHeight (default? 'px') which is set when a string cellHeight with a unit is passed (ex: '10rem') */\r\n  cellHeightUnit?: string;\r\n\r\n  /** list of children item to create when calling load() or addGrid() */\r\n  children?: GridStackWidget[];\r\n\r\n  /** number of columns (default?: 12). Note: IF you change this, CSS also have to change. See https://github.com/gridstack/gridstack.js#change-grid-columns.\r\n   * Note: for nested grids, it is recommended to use 'auto' which will always match the container grid-item current width (in column) to keep inside and outside\r\n   * items always the same. flag is NOT supported for regular non-nested grids.\r\n   */\r\n  column?: number | 'auto';\r\n\r\n  /** responsive column layout for width:column behavior */\r\n  columnOpts?: Responsive;\r\n\r\n  /** additional class on top of '.grid-stack' (which is required for our CSS) to differentiate this instance.\r\n  Note: only used by addGrid(), else your element should have the needed class */\r\n  class?: string;\r\n\r\n  /** disallows dragging of widgets (default?: false) */\r\n  disableDrag?: boolean;\r\n\r\n  /** disallows resizing of widgets (default?: false). */\r\n  disableResize?: boolean;\r\n\r\n  /** allows to override UI draggable options. (default?: { handle?: '.grid-stack-item-content', appendTo?: 'body' }) */\r\n  draggable?: DDDragOpt;\r\n\r\n  /** let user drag nested grid items out of a parent or not (default true - not supported yet) */\r\n  //dragOut?: boolean;\r\n\r\n  /** the type of engine to create (so you can subclass) default to GridStackEngine */\r\n  engineClass?: typeof GridStackEngine;\r\n\r\n  /** enable floating widgets (default?: false) See example (http://gridstack.github.io/gridstack.js/demo/float.html) */\r\n  float?: boolean;\r\n\r\n  /** draggable handle selector (default?: '.grid-stack-item-content') */\r\n  handle?: string;\r\n\r\n  /** draggable handle class (e.g. 'grid-stack-item-content'). If set 'handle' is ignored (default?: null) */\r\n  handleClass?: string;\r\n\r\n  /** additional widget class (default?: 'grid-stack-item') */\r\n  itemClass?: string;\r\n\r\n  /** re-layout mode when we're a subgrid and we are being resized. default to 'list' */\r\n  layout?: ColumnOptions;\r\n\r\n  /** true when widgets are only created when they scroll into view (visible) */\r\n  lazyLoad?: boolean;\r\n\r\n  /**\r\n   * gap between grid item and content (default?: 10). This will set all 4 sides and support the CSS formats below\r\n   *  an integer (px)\r\n   *  a string with possible units (ex: '2em', '20px', '2rem')\r\n   *  string with space separated values (ex: '5px 10px 0 20px' for all 4 sides, or '5em 10em' for top/bottom and left/right pairs like CSS).\r\n   * Note: all sides must have same units (last one wins, default px)\r\n   */\r\n  margin?: numberOrString;\r\n\r\n  /** OLD way to optionally set each side - use margin: '5px 10px 0 20px' instead. Used internally to store each side. */\r\n  marginTop?: numberOrString;\r\n  marginRight?: numberOrString;\r\n  marginBottom?: numberOrString;\r\n  marginLeft?: numberOrString;\r\n\r\n  /** (internal) unit for margin (default? 'px') set when `margin` is set as string with unit (ex: 2rem') */\r\n  marginUnit?: string;\r\n\r\n  /** maximum rows amount. Default? is 0 which means no maximum rows */\r\n  maxRow?: number;\r\n\r\n  /** minimum rows amount which is handy to prevent grid from collapsing when empty. Default is `0`.\r\n   * When no set the `min-height` CSS attribute on the grid div (in pixels) can be used, which will round to the closest row.\r\n   */\r\n  minRow?: number;\r\n\r\n  /** If you are using a nonce-based Content Security Policy, pass your nonce here and\r\n   * GridStack will add it to the `<style>` elements it creates. */\r\n  nonce?: string;\r\n\r\n  /** class for placeholder (default?: 'grid-stack-placeholder') */\r\n  placeholderClass?: string;\r\n\r\n  /** placeholder default content (default?: '') */\r\n  placeholderText?: string;\r\n\r\n  /** allows to override UI resizable options. default is { handles: 'se', autoHide: true on desktop, false on mobile } */\r\n  resizable?: DDResizeOpt;\r\n\r\n  /**\r\n   * if true widgets could be removed by dragging outside of the grid. It could also be a selector string (ex: \".trash\"),\r\n   * in this case widgets will be removed by dropping them there (default?: false)\r\n   * See example (http://gridstack.github.io/gridstack.js/demo/two.html)\r\n   */\r\n  removable?: boolean | string;\r\n\r\n  /** allows to override UI removable options. (default?: { accept: '.grid-stack-item' }) */\r\n  removableOptions?: DDRemoveOpt;\r\n\r\n  /** fix grid number of rows. This is a shortcut of writing `minRow:N, maxRow:N`. (default `0` no constrain) */\r\n  row?: number;\r\n\r\n  /**\r\n   * if true turns grid to RTL. Possible values are true, false, 'auto' (default?: 'auto')\r\n   * See [example](http://gridstack.github.io/gridstack.js/demo/right-to-left(rtl).html)\r\n   */\r\n  rtl?: boolean | 'auto';\r\n\r\n  /** set to true if all grid items (by default, but item can also override) height should be based on content size instead of WidgetItem.h to avoid v-scrollbars.\r\n   * Note: this is still row based, not pixels, so it will use ceil(getBoundingClientRect().height / getCellHeight())\r\n   */\r\n  sizeToContent?: boolean;\r\n\r\n  /**\r\n   * makes grid static (default?: false). If `true` widgets are not movable/resizable.\r\n   * You don't even need draggable/resizable. A CSS class\r\n   * 'grid-stack-static' is also added to the element.\r\n   */\r\n  staticGrid?: boolean;\r\n\r\n  /**\r\n   * @deprecated Not used anymore, styles are now implemented with local CSS variables\r\n   */\r\n  styleInHead?: boolean;\r\n\r\n  /** list of differences in options for automatically created sub-grids under us (inside our grid-items) */\r\n  subGridOpts?: GridStackOptions;\r\n\r\n  /** enable/disable the creation of sub-grids on the fly by dragging items completely\r\n   * over others (nest) vs partially (push). Forces `DDDragOpt.pause=true` to accomplish that. */\r\n  subGridDynamic?: boolean;\r\n}\r\n\r\n/** options used during GridStackEngine.moveNode() */\r\nexport interface GridStackMoveOpts extends GridStackPosition {\r\n  /** node to skip collision */\r\n  skip?: GridStackNode;\r\n  /** do we pack (default true) */\r\n  pack?: boolean;\r\n  /** true if we are calling this recursively to prevent simple swap or coverage collision - default false*/\r\n  nested?: boolean;\r\n  /** vars to calculate other cells coordinates */\r\n  cellWidth?: number;\r\n  cellHeight?: number;\r\n  marginTop?: number;\r\n  marginBottom?: number;\r\n  marginLeft?: number;\r\n  marginRight?: number;\r\n  /** position in pixels of the currently dragged items (for overlap check) */\r\n  rect?: GridStackPosition;\r\n  /** true if we're live resizing */\r\n  resizing?: boolean;\r\n  /** best node (most coverage) we collied with */\r\n  collide?: GridStackNode;\r\n  /** for collision check even if we don't move */\r\n  forceCollide?: boolean;\r\n}\r\n\r\nexport interface GridStackPosition {\r\n  /** widget position x (default?: 0) */\r\n  x?: number;\r\n  /** widget position y (default?: 0) */\r\n  y?: number;\r\n  /** widget dimension width (default?: 1) */\r\n  w?: number;\r\n  /** widget dimension height (default?: 1) */\r\n  h?: number;\r\n}\r\n\r\n/**\r\n * GridStack Widget creation options\r\n */\r\nexport interface GridStackWidget extends GridStackPosition {\r\n  /** if true then x, y parameters will be ignored and widget will be places on the first available position (default?: false) */\r\n  autoPosition?: boolean;\r\n  /** minimum width allowed during resize/creation (default?: undefined = un-constrained) */\r\n  minW?: number;\r\n  /** maximum width allowed during resize/creation (default?: undefined = un-constrained) */\r\n  maxW?: number;\r\n  /** minimum height allowed during resize/creation (default?: undefined = un-constrained) */\r\n  minH?: number;\r\n  /** maximum height allowed during resize/creation (default?: undefined = un-constrained) */\r\n  maxH?: number;\r\n  /** prevent direct resizing by the user (default?: undefined = un-constrained) */\r\n  noResize?: boolean;\r\n  /** prevents direct moving by the user (default?: undefined = un-constrained) */\r\n  noMove?: boolean;\r\n  /** prevents being pushed by other widgets or api (default?: undefined = un-constrained), which is different from `noMove` (user action only) */\r\n  locked?: boolean;\r\n  /** value for `gs-id` stored on the widget (default?: undefined) */\r\n  id?: string;\r\n  /** html to append inside as content */\r\n  content?: string;\r\n  /** true when widgets are only created when they scroll into view (visible) */\r\n  lazyLoad?: boolean;\r\n  /** local (vs grid) override - see GridStackOptions.\r\n   * Note: This also allow you to set a maximum h value (but user changeable during normal resizing) to prevent unlimited content from taking too much space (get scrollbar) */\r\n  sizeToContent?: boolean | number;\r\n  /** local override of GridStack.resizeToContentParent that specify the class to use for the parent (actual) vs child (wanted) height */\r\n  resizeToContentParent?: string;\r\n  /** optional nested grid options and list of children, which then turns into actual instance at runtime to get options from */\r\n  subGridOpts?: GridStackOptions;\r\n}\r\n\r\n/** Drag&Drop resize options */\r\nexport interface DDResizeOpt {\r\n  /** do resize handle hide by default until mouse over. default: true on desktop, false on mobile */\r\n  autoHide?: boolean;\r\n  /**\r\n   * sides where you can resize from (ex: 'e, se, s, sw, w') - default 'se' (south-east)\r\n   * Note: it is not recommended to resize from the top sides as weird side effect may occur.\r\n  */\r\n  handles?: string;\r\n  /**\r\n   * Custom element or query inside the widget node that is used instead of the\r\n   * generated resize handle.\r\n   */\r\n  element?: string | HTMLElement\r\n}\r\n\r\n/** Drag&Drop remove options */\r\nexport interface DDRemoveOpt {\r\n  /** class that can be removed (default?: opts.itemClass) */\r\n  accept?: string;\r\n  /** class that cannot be removed (default: 'grid-stack-non-removable') */\r\n  decline?: string;\r\n}\r\n\r\n/** Drag&Drop dragging options */\r\nexport interface DDDragOpt {\r\n  /** class selector of items that can be dragged. default to '.grid-stack-item-content' */\r\n  handle?: string;\r\n  /** default to 'body' */\r\n  appendTo?: string;\r\n  /** if set (true | msec), dragging placement (collision) will only happen after a pause by the user. Note: this is Global */\r\n  pause?: boolean | number;\r\n  /** default to `true` */\r\n  scroll?: boolean;\r\n  /** prevents dragging from starting on specified elements, listed as comma separated selectors (eg: '.no-drag'). default built in is 'input,textarea,button,select,option' */\r\n  cancel?: string;\r\n  /** helper function when dropping: 'clone' or your own method */\r\n  helper?: 'clone' | ((el: HTMLElement) => HTMLElement);\r\n  /** callbacks */\r\n  start?: (event: Event, ui: DDUIData) => void;\r\n  stop?: (event: Event) => void;\r\n  drag?: (event: Event, ui: DDUIData) => void;\r\n}\r\nexport interface Size {\r\n  width: number;\r\n  height: number;\r\n}\r\nexport interface Position {\r\n  top: number;\r\n  left: number;\r\n}\r\nexport interface Rect extends Size, Position {}\r\n\r\n/** data that is passed during drag and resizing callbacks */\r\nexport interface DDUIData {\r\n  position?: Position;\r\n  size?: Size;\r\n  draggable?: HTMLElement;\r\n  /* fields not used by GridStack but sent by jq ? leave in case we go back to them...\r\n  originalPosition? : Position;\r\n  offset?: Position;\r\n  originalSize?: Size;\r\n  element?: HTMLElement[];\r\n  helper?: HTMLElement[];\r\n  originalElement?: HTMLElement[];\r\n  */\r\n}\r\n\r\n/**\r\n * internal runtime descriptions describing the widgets in the grid\r\n */\r\nexport interface GridStackNode extends GridStackWidget {\r\n  /** pointer back to HTML element */\r\n  el?: GridItemHTMLElement;\r\n  /** pointer back to parent Grid instance */\r\n  grid?: GridStack;\r\n  /** actual sub-grid instance */\r\n  subGrid?: GridStack;\r\n  /** allow delay creation when visible */\r\n  visibleObservable?: IntersectionObserver;\r\n  /** @internal internal id used to match when cloning engines or saving column layouts */\r\n  _id?: number;\r\n  /** @internal does the node attr ned to be updated due to changed x,y,w,h values */\r\n  _dirty?: boolean;\r\n  /** @internal */\r\n  _updating?: boolean;\r\n  /** @internal true when over trash/another grid so we don't bother removing drag CSS style that would animate back to old position */\r\n  _isAboutToRemove?: boolean;\r\n  /** @internal true if item came from outside of the grid -> actual item need to be moved over */\r\n  _isExternal?: boolean;\r\n  /** @internal Mouse event that's causing moving|resizing */\r\n  _event?: MouseEvent;\r\n  /** @internal moving vs resizing */\r\n  _moving?: boolean;\r\n  /** @internal is resizing? */\r\n  _resizing?: boolean;\r\n  /** @internal true if we jumped down past item below (one time jump so we don't have to totally pass it) */\r\n  _skipDown?: boolean;\r\n  /** @internal original values before a drag/size */\r\n  _orig?: GridStackPosition;\r\n  /** @internal position in pixels used during collision check  */\r\n  _rect?: GridStackPosition;\r\n  /** @internal top/left pixel location before a drag so we can detect direction of move from last position*/\r\n  _lastUiPosition?: Position;\r\n  /** @internal set on the item being dragged/resized remember the last positions we've tried (but failed) so we don't try again during drag/resize */\r\n  _lastTried?: GridStackPosition;\r\n  /** @internal position willItFit() will use to position the item */\r\n  _willFitPos?: GridStackPosition;\r\n  /** @internal last drag Y pixel position used to incrementally update V scroll bar */\r\n  _prevYPix?: number;\r\n  /** @internal true if we've remove the item from ourself (dragging out) but might revert it back (release on nothing -> goes back) */\r\n  _temporaryRemoved?: boolean;\r\n  /** @internal true if we should remove DOM element on _notify() rather than clearing _id (old way) */\r\n  _removeDOM?: boolean;\r\n  /** @internal original position/size of item if dragged from sidebar */\r\n  _sidebarOrig?: GridStackPosition;\r\n  /** @internal had drag&drop been initialized */\r\n  _initDD?: boolean;\r\n}\r\n\r\n// add custom field to support drag/resize optimizations\r\nexport interface GridStackMouseEvent extends MouseEvent {\r\n  resizeDir?: string;\r\n}"
  },
  {
    "path": "src/utils.ts",
    "content": "/**\r\n * utils.ts 12.4.3\r\n * Copyright (c) 2021-2025 Alain Dumesny - see GridStack root license\r\n */\r\n\r\nimport { GridStackElement, GridStackNode, numberOrString, GridStackPosition, GridStackWidget } from './types';\r\n\r\nexport interface HeightData {\r\n  h: number;\r\n  unit: string;\r\n}\r\n\r\nexport interface DragTransform {\r\n  xScale: number;\r\n  yScale: number;\r\n  xOffset: number;\r\n  yOffset: number;\r\n}\r\n\r\n// /**\r\n//  * Checks for obsolete method names and provides deprecation warnings.\r\n//  * Creates a wrapper function that logs a deprecation warning when called.\r\n//  *\r\n//  * @param self the object context to apply the function to\r\n//  * @param f the new function to call\r\n//  * @param oldName the deprecated method name\r\n//  * @param newName the new method name to use instead\r\n//  * @param rev the version when the deprecation was introduced\r\n//  * @returns a wrapper function that warns about deprecation\r\n//  */\r\n// eslint-disable-next-line\r\n// export function obsolete(self, f, oldName: string, newName: string, rev: string): (...args: any[]) => any {\r\n//   const wrapper = (...args) => {\r\n//     console.warn('gridstack.js: Function `' + oldName + '` is deprecated in ' + rev + ' and has been replaced ' +\r\n//     'with `' + newName + '`. It will be **removed** in a future release');\r\n//     return f.apply(self, args);\r\n//   }\r\n//   wrapper.prototype = f.prototype;\r\n//   return wrapper;\r\n// }\r\n\r\n// /**\r\n//  * Checks for obsolete grid options and migrates them to new names.\r\n//  * Automatically copies old option values to new option names and shows deprecation warnings.\r\n//  *\r\n//  * @param opts the options object to check and migrate\r\n//  * @param oldName the deprecated option name\r\n//  * @param newName the new option name to use instead\r\n//  * @param rev the version when the deprecation was introduced\r\n//  */\r\n// export function obsoleteOpts(opts: GridStackOptions, oldName: string, newName: string, rev: string): void {\r\n//   if (opts[oldName] !== undefined) {\r\n//     opts[newName] = opts[oldName];\r\n//     console.warn('gridstack.js: Option `' + oldName + '` is deprecated in ' + rev + ' and has been replaced with `' +\r\n//       newName + '`. It will be **removed** in a future release');\r\n//   }\r\n// }\r\n\r\n// /**\r\n//  * Checks for obsolete grid options that have been completely removed.\r\n//  * Shows deprecation warnings for options that are no longer supported.\r\n//  *\r\n//  * @param opts the options object to check\r\n//  * @param oldName the removed option name\r\n//  * @param rev the version when the option was removed\r\n//  * @param info additional information about the removal\r\n//  */\r\n// export function obsoleteOptsDel(opts: GridStackOptions, oldName: string, rev: string, info: string): void {\r\n//   if (opts[oldName] !== undefined) {\r\n//     console.warn('gridstack.js: Option `' + oldName + '` is deprecated in ' + rev + info);\r\n//   }\r\n// }\r\n\r\n// /**\r\n//  * Checks for obsolete HTML element attributes and migrates them.\r\n//  * Automatically copies old attribute values to new attribute names and shows deprecation warnings.\r\n//  *\r\n//  * @param el the HTML element to check and migrate\r\n//  * @param oldName the deprecated attribute name\r\n//  * @param newName the new attribute name to use instead\r\n//  * @param rev the version when the deprecation was introduced\r\n//  */\r\n// export function obsoleteAttr(el: HTMLElement, oldName: string, newName: string, rev: string): void {\r\n//   const oldAttr = el.getAttribute(oldName);\r\n//   if (oldAttr !== null) {\r\n//     el.setAttribute(newName, oldAttr);\r\n//     console.warn('gridstack.js: attribute `' + oldName + '`=' + oldAttr + ' is deprecated on this object in ' + rev + ' and has been replaced with `' +\r\n//       newName + '`. It will be **removed** in a future release');\r\n//   }\r\n// }\r\n\r\n/**\r\n * Collection of utility methods used throughout GridStack.\r\n * These are general-purpose helper functions for DOM manipulation,\r\n * positioning calculations, object operations, and more.\r\n */\r\nexport class Utils {\r\n\r\n  /**\r\n   * Convert a potential selector into an actual list of HTML elements.\r\n   * Supports CSS selectors, element references, and special ID handling.\r\n   *\r\n   * @param els selector string, HTMLElement, or array of elements\r\n   * @param root optional root element to search within (defaults to document, useful for shadow DOM)\r\n   * @returns array of HTML elements matching the selector\r\n   *\r\n   * @example\r\n   * const elements = Utils.getElements('.grid-item');\r\n   * const byId = Utils.getElements('#myWidget');\r\n   * const fromShadow = Utils.getElements('.item', shadowRoot);\r\n   */\r\n  static getElements(els: GridStackElement, root: HTMLElement | Document = document): HTMLElement[] {\r\n    if (typeof els === 'string') {\r\n      const doc = ('getElementById' in root) ? root as Document : undefined;\r\n\r\n      // Note: very common for people use to id='1,2,3' which is only legal as HTML5 id, but not CSS selectors\r\n      // so if we start with a number, assume it's an id and just return that one item...\r\n      // see https://github.com/gridstack/gridstack.js/issues/2234#issuecomment-1523796562\r\n      if (doc && !isNaN(+els[0])) { // start with digit\r\n        const el = doc.getElementById(els);\r\n        return el ? [el] : [];\r\n      }\r\n\r\n      let list = root.querySelectorAll(els);\r\n      if (!list.length && els[0] !== '.' && els[0] !== '#') {\r\n        // see if mean to be a class\r\n        list = root.querySelectorAll('.' + els);\r\n\r\n        // else if mean to be an id\r\n        if (!list.length) list = root.querySelectorAll('#' + els);\r\n\r\n        // else see if gs-id attribute\r\n        if (!list.length) {\r\n          const el = root.querySelector<HTMLElement>(`[gs-id=\"${els}\"]`);\r\n          return el ? [el] : [];\r\n        }\r\n      }\r\n      return Array.from(list) as HTMLElement[];\r\n    }\r\n    return [els];\r\n  }\r\n\r\n  /**\r\n   * Convert a potential selector into a single HTML element.\r\n   * Similar to getElements() but returns only the first match.\r\n   *\r\n   * @param els selector string or HTMLElement\r\n   * @param root optional root element to search within (defaults to document)\r\n   * @returns the first HTML element matching the selector, or null if not found\r\n   *\r\n   * @example\r\n   * const element = Utils.getElement('#myWidget');\r\n   * const first = Utils.getElement('.grid-item');\r\n   */\r\n  static getElement(els: GridStackElement, root: HTMLElement | Document = document): HTMLElement {\r\n    if (typeof els === 'string') {\r\n      const doc = ('getElementById' in root) ? root as Document : undefined;\r\n      if (!els.length) return null;\r\n      if (doc && els[0] === '#') {\r\n        return doc.getElementById(els.substring(1));\r\n      }\r\n      if (els[0] === '#' || els[0] === '.' || els[0] === '[') {\r\n        return root.querySelector(els);\r\n      }\r\n\r\n      // if we start with a digit, assume it's an id (error calling querySelector('#1')) as class are not valid CSS\r\n      if (doc && !isNaN(+els[0])) { // start with digit\r\n        return doc.getElementById(els);\r\n      }\r\n\r\n      // finally try string, then id, then class\r\n      let el = root.querySelector(els);\r\n      if (doc && !el) { el = doc.getElementById(els) }\r\n      if (!el) { el = root.querySelector('.' + els) }\r\n      return el as HTMLElement;\r\n    }\r\n    return els;\r\n  }\r\n\r\n  /**\r\n   * Check if a widget should be lazy loaded based on node or grid settings.\r\n   *\r\n   * @param n the grid node to check\r\n   * @returns true if the item should be lazy loaded\r\n   *\r\n   * @example\r\n   * if (Utils.lazyLoad(node)) {\r\n   *   // Set up intersection observer for lazy loading\r\n   * }\r\n   */\r\n  static lazyLoad(n: GridStackNode): boolean {\r\n    return n.lazyLoad || n.grid?.opts?.lazyLoad && n.lazyLoad !== false;\r\n  }\r\n\r\n  /**\r\n   * Create a div element with the specified CSS classes.\r\n   *\r\n   * @param classes array of CSS class names to add\r\n   * @param parent optional parent element to append the div to\r\n   * @returns the created div element\r\n   *\r\n   * @example\r\n   * const div = Utils.createDiv(['grid-item', 'draggable']);\r\n   * const nested = Utils.createDiv(['content'], parentDiv);\r\n   */\r\n  static createDiv(classes: string[], parent?: HTMLElement): HTMLElement {\r\n    const el = document.createElement('div');\r\n    classes.forEach(c => {if (c) el.classList.add(c)});\r\n    parent?.appendChild(el);\r\n    return el;\r\n  }\r\n\r\n  /**\r\n   * Check if a widget should resize to fit its content.\r\n   *\r\n   * @param n the grid node to check (can be undefined)\r\n   * @param strict if true, only returns true for explicit sizeToContent:true (not numbers)\r\n   * @returns true if the widget should resize to content\r\n   *\r\n   * @example\r\n   * if (Utils.shouldSizeToContent(node)) {\r\n   *   // Trigger content-based resizing\r\n   * }\r\n   */\r\n  static shouldSizeToContent(n: GridStackNode | undefined, strict = false): boolean {\r\n    return n?.grid && (strict ?\r\n      (n.sizeToContent === true || (n.grid.opts.sizeToContent === true && n.sizeToContent === undefined)) :\r\n      (!!n.sizeToContent || (n.grid.opts.sizeToContent && n.sizeToContent !== false)));\r\n  }\r\n\r\n  /**\r\n   * Check if two grid positions overlap/intersect.\r\n   *\r\n   * @param a first position with x, y, w, h properties\r\n   * @param b second position with x, y, w, h properties\r\n   * @returns true if the positions overlap\r\n   *\r\n   * @example\r\n   * const overlaps = Utils.isIntercepted(\r\n   *   {x: 0, y: 0, w: 2, h: 1},\r\n   *   {x: 1, y: 0, w: 2, h: 1}\r\n   * ); // true - they overlap\r\n   */\r\n  static isIntercepted(a: GridStackPosition, b: GridStackPosition): boolean {\r\n    return !(a.y >= b.y + b.h || a.y + a.h <= b.y || a.x + a.w <= b.x || a.x >= b.x + b.w);\r\n  }\r\n\r\n  /**\r\n   * Check if two grid positions are touching (edges or corners).\r\n   *\r\n   * @param a first position\r\n   * @param b second position\r\n   * @returns true if the positions are touching\r\n   *\r\n   * @example\r\n   * const touching = Utils.isTouching(\r\n   *   {x: 0, y: 0, w: 2, h: 1},\r\n   *   {x: 2, y: 0, w: 1, h: 1}\r\n   * ); // true - they share an edge\r\n   */\r\n  static isTouching(a: GridStackPosition, b: GridStackPosition): boolean {\r\n    return Utils.isIntercepted(a, {x: b.x-0.5, y: b.y-0.5, w: b.w+1, h: b.h+1})\r\n  }\r\n\r\n  /**\r\n   * Calculate the overlapping area between two grid positions.\r\n   *\r\n   * @param a first position\r\n   * @param b second position\r\n   * @returns the area of overlap (0 if no overlap)\r\n   *\r\n   * @example\r\n   * const overlap = Utils.areaIntercept(\r\n   *   {x: 0, y: 0, w: 3, h: 2},\r\n   *   {x: 1, y: 0, w: 3, h: 2}\r\n   * ); // returns 4 (2x2 overlap)\r\n   */\r\n  static areaIntercept(a: GridStackPosition, b: GridStackPosition): number {\r\n    const x0 = (a.x > b.x) ? a.x : b.x;\r\n    const x1 = (a.x+a.w < b.x+b.w) ? a.x+a.w : b.x+b.w;\r\n    if (x1 <= x0) return 0; // no overlap\r\n    const y0 = (a.y > b.y) ? a.y : b.y;\r\n    const y1 = (a.y+a.h < b.y+b.h) ? a.y+a.h : b.y+b.h;\r\n    if (y1 <= y0) return 0; // no overlap\r\n    return (x1-x0) * (y1-y0);\r\n  }\r\n\r\n  /**\r\n   * Calculate the total area of a grid position.\r\n   *\r\n   * @param a position with width and height\r\n   * @returns the total area (width * height)\r\n   *\r\n   * @example\r\n   * const area = Utils.area({x: 0, y: 0, w: 3, h: 2}); // returns 6\r\n   */\r\n  static area(a: GridStackPosition): number {\r\n    return a.w * a.h;\r\n  }\r\n\r\n  /**\r\n   * Sort an array of grid nodes by position (y first, then x).\r\n   *\r\n   * @param nodes array of nodes to sort\r\n   * @param dir sort direction: 1 for ascending (top-left first), -1 for descending\r\n   * @returns the sorted array (modifies original)\r\n   *\r\n   * @example\r\n   * const sorted = Utils.sort(nodes); // Sort top-left to bottom-right\r\n   * const reverse = Utils.sort(nodes, -1); // Sort bottom-right to top-left\r\n   */\r\n  static sort(nodes: GridStackNode[], dir: 1 | -1 = 1): GridStackNode[] {\r\n    const und = 10000;\r\n    return nodes.sort((a, b) => {\r\n      const diffY = dir * ((a.y ?? und) - (b.y ?? und));\r\n      if (diffY === 0) return dir * ((a.x ?? und) - (b.x ?? und));\r\n      return diffY;\r\n    });\r\n  }\r\n\r\n  /**\r\n   * Find a grid node by its ID.\r\n   *\r\n   * @param nodes array of nodes to search\r\n   * @param id the ID to search for\r\n   * @returns the node with matching ID, or undefined if not found\r\n   *\r\n   * @example\r\n   * const node = Utils.find(nodes, 'widget-1');\r\n   * if (node) console.log('Found node at:', node.x, node.y);\r\n   */\r\n  static find(nodes: GridStackNode[], id: string): GridStackNode | undefined {\r\n    return id ? nodes.find(n => n.id === id) : undefined;\r\n  }\r\n\r\n  /**\r\n   * Convert various value types to boolean.\r\n   * Handles strings like 'false', 'no', '0' as false.\r\n   *\r\n   * @param v value to convert\r\n   * @returns boolean representation\r\n   *\r\n   * @example\r\n   * Utils.toBool('true');  // true\r\n   * Utils.toBool('false'); // false\r\n   * Utils.toBool('no');    // false\r\n   * Utils.toBool('1');     // true\r\n   */\r\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n  static toBool(v: unknown): boolean {\r\n    if (typeof v === 'boolean') {\r\n      return v;\r\n    }\r\n    if (typeof v === 'string') {\r\n      v = v.toLowerCase();\r\n      return !(v === '' || v === 'no' || v === 'false' || v === '0');\r\n    }\r\n    return Boolean(v);\r\n  }\r\n\r\n  /**\r\n   * Convert a string value to a number, handling null and empty strings.\r\n   *\r\n   * @param value string or null value to convert\r\n   * @returns number value, or undefined for null/empty strings\r\n   *\r\n   * @example\r\n   * Utils.toNumber('42');  // 42\r\n   * Utils.toNumber('');    // undefined\r\n   * Utils.toNumber(null);  // undefined\r\n   */\r\n  static toNumber(value: null | string): number {\r\n    return (value === null || value.length === 0) ? undefined : Number(value);\r\n  }\r\n\r\n  /**\r\n   * Parse a height value with units into numeric value and unit string.\r\n   * Supports px, em, rem, vh, vw, %, cm, mm units.\r\n   *\r\n   * @param val height value as number or string with units\r\n   * @returns object with h (height) and unit properties\r\n   *\r\n   * @example\r\n   * Utils.parseHeight('100px');  // {h: 100, unit: 'px'}\r\n   * Utils.parseHeight('2rem');   // {h: 2, unit: 'rem'}\r\n   * Utils.parseHeight(50);       // {h: 50, unit: 'px'}\r\n   */\r\n  static parseHeight(val: numberOrString): HeightData {\r\n    let h: number;\r\n    let unit = 'px';\r\n    if (typeof val === 'string') {\r\n      if (val === 'auto' || val === '') h = 0;\r\n      else {\r\n        const match = val.match(/^(-[0-9]+\\.[0-9]+|[0-9]*\\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);\r\n        if (!match) {\r\n          throw new Error(`Invalid height val = ${val}`);\r\n        }\r\n        unit = match[2] || 'px';\r\n        h = parseFloat(match[1]);\r\n      }\r\n    } else {\r\n      h = val;\r\n    }\r\n    return { h, unit };\r\n  }\r\n\r\n  /**\r\n   * Copy unset fields from source objects to target object (shallow merge with defaults).\r\n   * Similar to Object.assign but only sets undefined/null fields.\r\n   *\r\n   * @param target the object to copy defaults into\r\n   * @param sources one or more source objects to copy defaults from\r\n   * @returns the modified target object\r\n   *\r\n   * @example\r\n   * const config = { width: 100 };\r\n   * Utils.defaults(config, { width: 200, height: 50 });\r\n   * // config is now { width: 100, height: 50 }\r\n   */\r\n  // eslint-disable-next-line\r\n  static defaults(target, ...sources): {} {\r\n\r\n    sources.forEach(source => {\r\n      for (const key in source) {\r\n        if (!source.hasOwnProperty(key)) return;\r\n        if (target[key] === null || target[key] === undefined) {\r\n          target[key] = source[key];\r\n        } else if (typeof source[key] === 'object' && typeof target[key] === 'object') {\r\n          // property is an object, recursively add it's field over... #1373\r\n          Utils.defaults(target[key], source[key]);\r\n        }\r\n      }\r\n    });\r\n\r\n    return target;\r\n  }\r\n\r\n  /**\r\n   * Compare two objects for equality (shallow comparison).\r\n   * Checks if objects have the same fields and values at one level deep.\r\n   *\r\n   * @param a first object to compare\r\n   * @param b second object to compare\r\n   * @returns true if objects have the same values\r\n   *\r\n   * @example\r\n   * Utils.same({x: 1, y: 2}, {x: 1, y: 2}); // true\r\n   * Utils.same({x: 1}, {x: 1, y: 2}); // false\r\n   */\r\n  static same(a: unknown, b: unknown): boolean {\r\n    if (typeof a !== 'object')  return a == b;\r\n    if (typeof a !== typeof b) return false;\r\n    // else we have object, check just 1 level deep for being same things...\r\n    if (Object.keys(a).length !== Object.keys(b).length) return false;\r\n    for (const key in a) {\r\n      if (a[key] !== b[key]) return false;\r\n    }\r\n    return true;\r\n  }\r\n\r\n  /**\r\n   * Copy position and size properties from one widget to another.\r\n   * Copies x, y, w, h and optionally min/max constraints.\r\n   *\r\n   * @param a target widget to copy to\r\n   * @param b source widget to copy from\r\n   * @param doMinMax if true, also copy min/max width/height constraints\r\n   * @returns the target widget (a)\r\n   *\r\n   * @example\r\n   * Utils.copyPos(widget1, widget2); // Copy position/size\r\n   * Utils.copyPos(widget1, widget2, true); // Also copy constraints\r\n   */\r\n  static copyPos(a: GridStackWidget, b: GridStackWidget, doMinMax = false): GridStackWidget {\r\n    if (b.x !== undefined) a.x = b.x;\r\n    if (b.y !== undefined) a.y = b.y;\r\n    if (b.w !== undefined) a.w = b.w;\r\n    if (b.h !== undefined) a.h = b.h;\r\n    if (doMinMax) {\r\n      if (b.minW) a.minW = b.minW;\r\n      if (b.minH) a.minH = b.minH;\r\n      if (b.maxW) a.maxW = b.maxW;\r\n      if (b.maxH) a.maxH = b.maxH;\r\n    }\r\n    return a;\r\n  }\r\n\r\n  /** true if a and b has same size & position */\r\n  static samePos(a: GridStackPosition, b: GridStackPosition): boolean {\r\n    return a && b && a.x === b.x && a.y === b.y && (a.w || 1) === (b.w || 1) && (a.h || 1) === (b.h || 1);\r\n  }\r\n\r\n  /** given a node, makes sure it's min/max are valid */\r\n  static sanitizeMinMax(node: GridStackNode) {\r\n    // remove 0, undefine, null\r\n    if (!node.minW) { delete node.minW; }\r\n    if (!node.minH) { delete node.minH; }\r\n    if (!node.maxW) { delete node.maxW; }\r\n    if (!node.maxH) { delete node.maxH; }\r\n  }\r\n\r\n  /** removes field from the first object if same as the second objects (like diffing) and internal '_' for saving */\r\n  static removeInternalAndSame(a: unknown, b: unknown):void {\r\n    if (typeof a !== 'object' || typeof b !== 'object') return;\r\n    // skip arrays as we don't know how to hydrate them (unlike object spread operator)\r\n    if (Array.isArray(a) || Array.isArray(b)) return;\r\n    for (let key in a) {\r\n      const aVal = a[key];\r\n      const bVal = b[key];\r\n      if (key[0] === '_' || aVal === bVal) {\r\n        delete a[key]\r\n      } else if (aVal && typeof aVal === 'object' && bVal !== undefined) {\r\n        Utils.removeInternalAndSame(aVal, bVal);\r\n        if (!Object.keys(aVal).length) { delete a[key] }\r\n      }\r\n    }\r\n  }\r\n\r\n  /** removes internal fields '_' and default values for saving */\r\n  static removeInternalForSave(n: GridStackNode, removeEl = true): void {\r\n    for (let key in n) { if (key[0] === '_' || n[key] === null || n[key] === undefined ) delete n[key]; }\r\n    delete n.grid;\r\n    if (removeEl) delete n.el;\r\n    // delete default values (will be re-created on read)\r\n    if (!n.autoPosition) delete n.autoPosition;\r\n    if (!n.noResize) delete n.noResize;\r\n    if (!n.noMove) delete n.noMove;\r\n    if (!n.locked) delete n.locked;\r\n    if (n.w === 1 || n.w === n.minW) delete n.w;\r\n    if (n.h === 1 || n.h === n.minH) delete n.h;\r\n  }\r\n\r\n  /** return the closest parent (or itself) matching the given class */\r\n  // static closestUpByClass(el: HTMLElement, name: string): HTMLElement {\r\n  //   while (el) {\r\n  //     if (el.classList.contains(name)) return el;\r\n  //     el = el.parentElement\r\n  //   }\r\n  //   return null;\r\n  // }\r\n\r\n  /** delay calling the given function for given delay, preventing new calls from happening while waiting */\r\n  static throttle(func: () => void, delay: number): () => void {\r\n    let isWaiting = false;\r\n    return (...args) => {\r\n      if (!isWaiting) {\r\n        isWaiting = true;\r\n        setTimeout(() => { func(...args); isWaiting = false; }, delay);\r\n      }\r\n    }\r\n  }\r\n\r\n  static removePositioningStyles(el: HTMLElement): void {\r\n    const style = el.style;\r\n    if (style.position) {\r\n      style.removeProperty('position');\r\n    }\r\n    if (style.left) {\r\n      style.removeProperty('left');\r\n    }\r\n    if (style.top) {\r\n      style.removeProperty('top');\r\n    }\r\n    if (style.width) {\r\n      style.removeProperty('width');\r\n    }\r\n    if (style.height) {\r\n      style.removeProperty('height');\r\n    }\r\n  }\r\n\r\n  /** @internal returns the passed element if scrollable, else the closest parent that will, up to the entire document scrolling element */\r\n  static getScrollElement(el?: HTMLElement): HTMLElement {\r\n    if (!el) return document.scrollingElement as HTMLElement || document.documentElement; // IE support\r\n    const style = getComputedStyle(el);\r\n    const overflowRegex = /(auto|scroll)/;\r\n\r\n    if (overflowRegex.test(style.overflow + style.overflowY)) {\r\n      return el;\r\n    } else {\r\n      return Utils.getScrollElement(el.parentElement);\r\n    }\r\n  }\r\n\r\n  /** @internal */\r\n  static updateScrollPosition(el: HTMLElement, position: {top: number}, distance: number): void {\r\n    const scrollEl = Utils.getScrollElement(el);\r\n    if (!scrollEl) return;\r\n\r\n    const elRect = el.getBoundingClientRect();\r\n    const scrollRect = scrollEl.getBoundingClientRect();\r\n    const innerHeightOrClientHeight = (window.innerHeight || document.documentElement.clientHeight);\r\n\r\n    const offsetDiffDown = elRect.bottom - Math.min(scrollRect.bottom, innerHeightOrClientHeight);\r\n    const offsetDiffUp = elRect.top - Math.max(scrollRect.top, 0);\r\n    const prevScroll = scrollEl.scrollTop;\r\n\r\n    if (offsetDiffUp < 0 && distance < 0) {\r\n      // scroll up\r\n      if (el.offsetHeight > scrollRect.height) {\r\n        scrollEl.scrollTop += distance;\r\n      } else {\r\n        scrollEl.scrollTop += Math.abs(offsetDiffUp) > Math.abs(distance) ? distance : offsetDiffUp;\r\n      }\r\n    } else if (offsetDiffDown > 0 && distance > 0) {\r\n      // scroll down\r\n      if (el.offsetHeight > scrollRect.height) {\r\n        scrollEl.scrollTop += distance;\r\n      } else {\r\n        scrollEl.scrollTop += offsetDiffDown > distance ? distance : offsetDiffDown;\r\n      }\r\n    }\r\n\r\n    position.top += scrollEl.scrollTop - prevScroll;\r\n  }\r\n\r\n  /**\r\n   * @internal Function used to scroll the page.\r\n   *\r\n   * @param event `MouseEvent` that triggers the resize\r\n   * @param el `HTMLElement` that's being resized\r\n   * @param distance Distance from the V edges to start scrolling\r\n   */\r\n  static updateScrollResize(event: MouseEvent, el: HTMLElement, distance: number): void {\r\n    const scrollEl = Utils.getScrollElement(el);\r\n    const height = scrollEl.clientHeight;\r\n    // #1727 event.clientY is relative to viewport, so must compare this against position of scrollEl getBoundingClientRect().top\r\n    // #1745 Special situation if scrollEl is document 'html': here browser spec states that\r\n    // clientHeight is height of viewport, but getBoundingClientRect() is rectangle of html element;\r\n    // this discrepancy arises because in reality scrollbar is attached to viewport, not html element itself.\r\n    const offsetTop = (scrollEl === Utils.getScrollElement()) ? 0 : scrollEl.getBoundingClientRect().top;\r\n    const pointerPosY = event.clientY - offsetTop;\r\n    const top = pointerPosY < distance;\r\n    const bottom = pointerPosY > height - distance;\r\n\r\n    if (top) {\r\n      // This also can be done with a timeout to keep scrolling while the mouse is\r\n      // in the scrolling zone. (will have smoother behavior)\r\n      scrollEl.scrollBy({ behavior: 'smooth', top: pointerPosY - distance});\r\n    } else if (bottom) {\r\n      scrollEl.scrollBy({ behavior: 'smooth', top: distance - (height - pointerPosY)});\r\n    }\r\n  }\r\n\r\n  /** single level clone, returning a new object with same top fields. This will share sub objects and arrays */\r\n  static clone<T>(obj: T): T {\r\n    if (obj === null || obj === undefined || typeof(obj) !== 'object') {\r\n      return obj;\r\n    }\r\n    // return Object.assign({}, obj);\r\n    if (obj instanceof Array) {\r\n      // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n      return [...obj] as any;\r\n    }\r\n    return {...obj};\r\n  }\r\n\r\n  /**\r\n   * Recursive clone version that returns a full copy, checking for nested objects and arrays ONLY.\r\n   * Note: this will use as-is any key starting with double __ (and not copy inside) some lib have circular dependencies.\r\n   */\r\n  static cloneDeep<T>(obj: T): T {\r\n    // list of fields we will skip during cloneDeep (nested objects, other internal)\r\n    const skipFields = ['parentGrid', 'el', 'grid', 'subGrid', 'engine'];\r\n    // return JSON.parse(JSON.stringify(obj)); // doesn't work with date format ?\r\n    const ret = Utils.clone(obj);\r\n    for (const key in ret) {\r\n      // NOTE: we don't support function/circular dependencies so skip those properties for now...\r\n      if (ret.hasOwnProperty(key) && typeof(ret[key]) === 'object' && key.substring(0, 2) !== '__' && !skipFields.find(k => k === key)) {\r\n        ret[key] = Utils.cloneDeep(obj[key]);\r\n      }\r\n    }\r\n    return ret;\r\n  }\r\n\r\n  /** deep clone the given HTML node, removing teh unique id field */\r\n  public static cloneNode(el: HTMLElement): HTMLElement {\r\n    const node = el.cloneNode(true) as HTMLElement;\r\n    node.removeAttribute('id');\r\n    return node;\r\n  }\r\n\r\n  public static appendTo(el: HTMLElement, parent: string | HTMLElement): void {\r\n    let parentNode: HTMLElement;\r\n    if (typeof parent === 'string') {\r\n      parentNode = Utils.getElement(parent);\r\n    } else {\r\n      parentNode = parent;\r\n    }\r\n    if (parentNode) {\r\n      parentNode.appendChild(el);\r\n    }\r\n  }\r\n\r\n  // public static setPositionRelative(el: HTMLElement): void {\r\n  //   if (!(/^(?:r|a|f)/).test(getComputedStyle(el).position)) {\r\n  //     el.style.position = \"relative\";\r\n  //   }\r\n  // }\r\n\r\n  public static addElStyles(el: HTMLElement, styles: { [prop: string]: string | string[] }): void {\r\n    if (styles instanceof Object) {\r\n      for (const s in styles) {\r\n        if (styles.hasOwnProperty(s)) {\r\n          if (Array.isArray(styles[s])) {\r\n            // support fallback value\r\n            (styles[s] as string[]).forEach(val => {\r\n              el.style[s] = val;\r\n            });\r\n          } else {\r\n            el.style[s] = styles[s];\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n\r\n  public static initEvent<T>(e: DragEvent | MouseEvent, info: { type: string; target?: EventTarget }): T {\r\n    const evt = { type: info.type };\r\n    const obj = {\r\n      button: 0,\r\n      which: 0,\r\n      buttons: 1,\r\n      bubbles: true,\r\n      cancelable: true,\r\n      target: info.target ? info.target : e.target\r\n    };\r\n    ['altKey','ctrlKey','metaKey','shiftKey'].forEach(p => evt[p] = e[p]); // keys\r\n    ['pageX','pageY','clientX','clientY','screenX','screenY'].forEach(p => evt[p] = e[p]); // point info\r\n    return {...evt, ...obj} as unknown as T;\r\n  }\r\n\r\n  /** copies the MouseEvent (or convert Touch) properties and sends it as another event to the given target */\r\n  public static simulateMouseEvent(e: MouseEvent | Touch, simulatedType: string, target?: EventTarget): void {\r\n    const me = e as MouseEvent;\r\n    const simulatedEvent = new MouseEvent(simulatedType, {\r\n      bubbles: true,\r\n      composed: true,\r\n      cancelable: true,\r\n      view: window,\r\n      detail: 1,\r\n      screenX: e.screenX,\r\n      screenY: e.screenY,\r\n      clientX: e.clientX,\r\n      clientY: e.clientY,\r\n      ctrlKey: me.ctrlKey??false,\r\n      altKey: me.altKey??false,\r\n      shiftKey: me.shiftKey??false,\r\n      metaKey: me.metaKey??false,\r\n      button: 0,\r\n      relatedTarget: e.target\r\n    });\r\n\r\n    (target || e.target).dispatchEvent(simulatedEvent);\r\n  }\r\n\r\n  /**\r\n   * defines an element that is used to get the offset and scale from grid transforms\r\n   * returns the scale and offsets from said element\r\n  */\r\n  public static getValuesFromTransformedElement(parent: HTMLElement): DragTransform {\r\n    const transformReference = document.createElement('div');\r\n    Utils.addElStyles(transformReference, {\r\n      opacity: '0',\r\n      position: 'fixed',\r\n      top: 0 + 'px',\r\n      left: 0 + 'px',\r\n      width: '1px',\r\n      height: '1px',\r\n      zIndex: '-999999',\r\n    });\r\n    parent.appendChild(transformReference);\r\n    const transformValues = transformReference.getBoundingClientRect();\r\n    parent.removeChild(transformReference);\r\n    transformReference.remove();\r\n    return {\r\n      xScale: 1 / transformValues.width,\r\n      yScale: 1 / transformValues.height,\r\n      xOffset: transformValues.left,\r\n      yOffset: transformValues.top,\r\n    }\r\n  }\r\n\r\n  /** swap the given object 2 field values */\r\n  public static swap(o: unknown, a: string, b: string): void {\r\n    if (!o) return;\r\n    const tmp = o[a]; o[a] = o[b]; o[b] = tmp;\r\n  }\r\n\r\n  /** returns true if event is inside the given element rectangle */\r\n  // Note: Safari Mac has null event.relatedTarget which causes #1684 so check if DragEvent is inside the coordinates instead\r\n  //    Utils.el.contains(event.relatedTarget as HTMLElement)\r\n  // public static inside(e: MouseEvent, el: HTMLElement): boolean {\r\n  //   // srcElement, toElement, target: all set to placeholder when leaving simple grid, so we can't use that (Chrome)\r\n  //   const target: HTMLElement = e.relatedTarget || (e as any).fromElement;\r\n  //   if (!target) {\r\n  //     const { bottom, left, right, top } = el.getBoundingClientRect();\r\n  //     return (e.x < right && e.x > left && e.y < bottom && e.y > top);\r\n  //   }\r\n  //   return el.contains(target);\r\n  // }\r\n\r\n  /** true if the item can be rotated (checking for prop, not space available) */\r\n  public static canBeRotated(n: GridStackNode): boolean {\r\n    return !(!n || n.w === n.h || n.locked || n.noResize || n.grid?.opts.disableResize || (n.minW && n.minW === n.maxW) || (n.minH && n.minH === n.maxH));\r\n  }\r\n}"
  },
  {
    "path": "tsconfig.build.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"compilerOptions\": {\n    \"skipLibCheck\": true\n  },\n  \"include\": [\n    \"./src/**/*.ts\"\n  ],\n  \"exclude\": [\n    \"./src/**/*.spec.ts\",\n    \"./src/**/*.test.ts\",\n    \"./spec/**/*\",\n    \"./vitest.setup.ts\",\n    \"./vitest.config.ts\",\n    \"./angular/projects/lib/src/**/*.spec.ts\",\n    \"./angular/projects/lib/src/test.ts\",\n    \"./angular/projects/demo/**/*\",\n    \"./angular/node_modules/**/*\",\n    \"./demo/**/*\",\n    \"./node_modules/**/*\"\n  ]\n}\n"
  },
  {
    "path": "tsconfig.docs.json",
    "content": "{\n  \"extends\": \"./tsconfig.json\",\n  \"compilerOptions\": {\n    \"skipLibCheck\": true,\n    \"types\": []\n  },\n  \"include\": [\n    \"./src/**/*.ts\"\n  ],\n  \"exclude\": [\n    \"./src/**/*.spec.ts\",\n    \"./src/**/*.test.ts\",\n    \"./spec/**/*\",\n    \"./angular/**/*\",\n    \"./demo/**/*\",\n    \"./node_modules/**/*\"\n  ]\n}\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    // \"allowJs\": true,\n    // \"esModuleInterop\": true,\n    // \"allowSyntheticDefaultImports\": true\n    \"declaration\": true,\n    \"emitDecoratorMetadata\": true,\n    \"experimentalDecorators\": true,\n    \"inlineSources\": true,\n    \"lib\": [ \"es2017\", \"es2015\", \"dom\" ],\n    \"module\": \"ES2020\",\n    \"noImplicitAny\": false,\n    \"outDir\": \"./dist\",\n    \"sourceMap\": true,\n    \"strict\": false,\n    \"target\": \"ES2020\",\n    \"types\": [\"vitest/globals\", \"@testing-library/jest-dom\", \"node\"],\n    \"skipLibCheck\": true,\n    \"allowSyntheticDefaultImports\": true,\n    \"esModuleInterop\": true,\n    \"moduleResolution\": \"node\"\n  }, \n  \"include\": [\n    \"./src/**/*.ts\",\n    \"./spec/**/*.ts\",\n    \"./vitest.setup.ts\",\n    \"./vitest.config.ts\"\n  ],\n  \"typeroots\": [\n    \"./node_modules/@types\"\n  ]\n}\n"
  },
  {
    "path": "typedoc.html.json",
    "content": "{\n  \"$schema\": \"https://typedoc.org/schema.json\",\n  \"entryPoints\": [\"src/gridstack.ts\"],\n  \"tsconfig\": \"tsconfig.docs.json\",\n  \"excludeExternals\": false,\n  \"out\": \"doc/html\",\n  \"exclude\": [\n    \"**/*.spec.ts\",\n    \"**/*.test.ts\",\n    \"**/spec/**\",\n    \"**/test/**\",\n    \"**/demo/**\",\n    \"demo/**\",\n    \"node_modules/**\"\n  ],\n  \"excludePrivate\": true,\n  \"excludeProtected\": false,\n  \"excludeInternal\": true,\n  \"includeVersion\": true,\n  \"sort\": [\"alphabetical\"],\n  \"kindSortOrder\": [\n    \"Class\",\n    \"Interface\", \n    \"TypeAlias\",\n    \"Variable\",\n    \"Function\"\n  ],\n  \"groupOrder\": [\n    \"Classes\",\n    \"Interfaces\",\n    \"Type aliases\",\n    \"Variables\",\n    \"Functions\"\n  ],\n  \"categorizeByGroup\": true,\n  \"defaultCategory\": \"Other\",\n  \"categoryOrder\": [\n    \"Main\",\n    \"Options\",\n    \"Events\",\n    \"Utilities\",\n    \"Types\",\n    \"*\"\n  ],\n  \"readme\": \"none\",\n  \"theme\": \"default\",\n  \"hideGenerator\": false,\n  \"searchInComments\": true,\n  \"searchInDocuments\": true,\n  \"cleanOutputDir\": true,\n  \"titleLink\": \"https://gridstackjs.com/\",\n  \"navigationLinks\": {\n    \"GitHub\": \"https://github.com/gridstack/gridstack.js\",\n    \"Demo\": \"https://gridstackjs.com/demo/\"\n  },\n  \"sidebarLinks\": {\n    \"Documentation\": \"https://github.com/gridstack/gridstack.js/blob/master/README.md\",\n  },\n  \"hostedBaseUrl\": \"https://gridstack.github.io/gridstack.js/\",\n  \"githubPages\": true,\n  \"gitRevision\": \"master\",\n  \"gitRemote\": \"origin\"\n}\n"
  },
  {
    "path": "typedoc.json",
    "content": "{\n  \"$schema\": \"https://typedoc.org/schema.json\",\n  \"entryPoints\": [\"src/gridstack.ts\"],\n  \"tsconfig\": \"tsconfig.docs.json\",\n  \"excludeExternals\": false,\n  \"out\": \"doc\",\n  \"plugin\": [\"typedoc-plugin-markdown\"],\n  \"theme\": \"markdown\",\n  \"exclude\": [\n    \"**/*.spec.ts\",\n    \"**/*.test.ts\",\n    \"**/spec/**\",\n    \"**/test/**\",\n    \"**/demo/**\",\n    \"demo/**\",\n    \"demo/*\",\n    \"**/demo/*\",\n    \"**/*demo*\",\n    \"node_modules/**\"\n  ],\n  \"excludePrivate\": true,\n  \"excludeProtected\": false,\n  \"excludeInternal\": true,\n  \"includeVersion\": true,\n  \"sort\": [\"alphabetical\"],\n  \"kindSortOrder\": [\n    \"Class\",\n    \"Interface\", \n    \"TypeAlias\",\n    \"Variable\",\n    \"Function\"\n  ],\n  \"groupOrder\": [\n    \"Classes\",\n    \"Interfaces\",\n    \"Type aliases\",\n    \"Variables\",\n    \"Functions\"\n  ],\n  \"categorizeByGroup\": true,\n  \"defaultCategory\": \"Other\",\n  \"categoryOrder\": [\n    \"Main\",\n    \"Options\",\n    \"Events\",\n    \"Utilities\",\n    \"Types\",\n    \"*\"\n  ],\n  \"readme\": \"none\",\n  \"hidePageHeader\": true,\n  \"hideBreadcrumbs\": true,\n  \"hidePageTitle\": false,\n  \"disableSources\": false,\n  \"useCodeBlocks\": true,\n  \"indexFormat\": \"table\",\n  \"parametersFormat\": \"table\",\n  \"interfacePropertiesFormat\": \"table\",\n  \"classPropertiesFormat\": \"table\",\n  \"enumMembersFormat\": \"table\",\n  \"typeDeclarationFormat\": \"table\",\n  \"propertyMembersFormat\": \"table\",\n  \"expandObjects\": false,\n  \"expandParameters\": false,\n  \"blockTagsPreserveOrder\": [\n    \"@param\",\n    \"@returns\",\n    \"@throws\"\n  ],\n  \"outputFileStrategy\": \"modules\",\n  \"mergeReadme\": false,\n  \"entryFileName\": \"API\",\n  \"cleanOutputDir\": false,\n  \"excludeReferences\": true,\n  \"gitRevision\": \"master\",\n  \"gitRemote\": \"origin\"\n}\n"
  },
  {
    "path": "vitest.config.ts",
    "content": "/// <reference types=\"vitest\" />\nimport { defineConfig } from 'vitest/config'\n\nexport default defineConfig({\n  test: {\n    // Enable globals (describe, it, expect, etc.) without imports\n    globals: true,\n    \n    // Use jsdom for DOM simulation (required for testing DOM-related code)\n    environment: 'jsdom',\n    \n    // Setup files to run before tests\n    setupFiles: ['./vitest.setup.ts'],\n    \n    // Test file patterns\n    include: [\n      'spec/**/*-spec.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',\n      'spec/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}',\n      'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'\n    ],\n    \n    // Exclude patterns\n    exclude: [\n      '**/node_modules/**',\n      '**/dist/**',\n      '**/angular/**',\n      '**/react/**',\n      '**/demo/**',\n      '**/spec/e2e/**' // Exclude old Protractor E2E tests\n    ],\n\n    // Coverage configuration\n    coverage: {\n      provider: 'v8', // Use V8's built-in coverage (faster and more accurate)\n      reporter: ['text', 'json', 'html', 'lcov'],\n      exclude: [\n        'coverage/**',\n        'dist/**',\n        'node_modules/**',\n        'demo/**',\n        'angular/**',\n        'react/**',\n        '**/*.d.ts',\n        '**/*.config.{js,ts}',\n        '**/karma.conf.js',\n        'scripts/**',\n        'spec/e2e/**' // Exclude e2e tests from coverage\n      ],\n      // Coverage thresholds (optional - set to your desired levels)\n      thresholds: {\n        global: {\n          branches: 80,\n          functions: 80,\n          lines: 80,\n          statements: 80\n        }\n      },\n      // Include source files for coverage even if not tested\n      all: true,\n      include: ['src/**/*.{js,ts}']\n    },\n\n    // Test timeout (in milliseconds)\n    testTimeout: 10000,\n\n    // Hook timeout (in milliseconds) \n    hookTimeout: 10000,\n\n    // Reporter configuration\n    reporters: ['verbose', 'html'],\n\n    // Output directory for test results\n    outputFile: {\n      html: './coverage/test-results.html'\n    }\n  },\n\n  // Resolve configuration for imports\n  resolve: {\n    alias: {\n      '@': '/src'\n    }\n  }\n})\n"
  },
  {
    "path": "vitest.setup.ts",
    "content": "import '@testing-library/jest-dom'\n\n// Global test setup\n// This file runs before each test file\n\n// Mock DOM APIs that might not be available in jsdom\nObject.defineProperty(window, 'matchMedia', {\n  writable: true,\n  value: vi.fn().mockImplementation(query => ({\n    matches: false,\n    media: query,\n    onchange: null,\n    addListener: vi.fn(), // deprecated\n    removeListener: vi.fn(), // deprecated\n    addEventListener: vi.fn(),\n    removeEventListener: vi.fn(),\n    dispatchEvent: vi.fn(),\n  })),\n});\n\n// Mock ResizeObserver\n(globalThis as any).ResizeObserver = vi.fn().mockImplementation(() => ({\n  observe: vi.fn(),\n  unobserve: vi.fn(),\n  disconnect: vi.fn(),\n}));\n\n// Mock IntersectionObserver  \n(globalThis as any).IntersectionObserver = vi.fn().mockImplementation(() => ({\n  observe: vi.fn(),\n  unobserve: vi.fn(),\n  disconnect: vi.fn(),\n}));\n\n// Mock requestAnimationFrame\n(globalThis as any).requestAnimationFrame = vi.fn().mockImplementation((cb: Function) => {\n  return setTimeout(cb, 0);\n});\n\n(globalThis as any).cancelAnimationFrame = vi.fn().mockImplementation((id: number) => {\n  clearTimeout(id);\n});\n\n// Mock performance.now for timing-related tests\nObject.defineProperty(window, 'performance', {\n  writable: true,\n  value: {\n    now: vi.fn(() => Date.now())\n  }\n});\n\n// Mock CSS properties that might be used by gridstack\nObject.defineProperty(window, 'getComputedStyle', {\n  value: () => ({\n    getPropertyValue: () => '',\n    width: '100px',\n    height: '100px',\n    marginTop: '0px',\n    marginBottom: '0px',\n    marginLeft: '0px',\n    marginRight: '0px'\n  })\n});\n\n// Mock scrollTo for tests that might trigger scrolling\nwindow.scrollTo = vi.fn();\n\n// Setup DOM environment\nObject.defineProperty(window, 'location', {\n  value: {\n    href: 'http://localhost:3000',\n    origin: 'http://localhost:3000',\n    pathname: '/',\n    search: '',\n    hash: ''\n  },\n  writable: true\n});\n\n// Global test utilities\n(globalThis as any).createMockElement = (tagName: string = 'div', attributes: Record<string, string> = {}) => {\n  const element = document.createElement(tagName);\n  Object.entries(attributes).forEach(([key, value]) => {\n    element.setAttribute(key, value);\n  });\n  return element;\n};\n\n// Console error/warning suppression for expected errors in tests\nconst originalError = console.error;\nconst originalWarn = console.warn;\n\nbeforeEach(() => {\n  // Reset console methods for each test\n  console.error = originalError;\n  console.warn = originalWarn;\n});\n\n// Helper to suppress expected console errors/warnings\n(globalThis as any).suppressConsoleErrors = () => {\n  console.error = vi.fn();\n  console.warn = vi.fn();\n};\n"
  },
  {
    "path": "webpack.config.js",
    "content": "const path = require('path');\r\n\r\nmodule.exports = {\r\n  entry: {\r\n    'gridstack-all': './src/gridstack.ts',\r\n  },\r\n  mode: 'production', // production vs development\r\n  devtool: 'source-map',\r\n  // devtool: 'eval-source-map', // for best (large .js) debugging. see https://survivejs.com/webpack/building/source-maps/\r\n  module: {\r\n    rules: [\r\n      {\r\n        test: /\\.ts$/,\r\n        use: {\r\n          loader: 'ts-loader',\r\n          options: {\r\n            configFile: 'tsconfig.build.json'\r\n          }\r\n        },\r\n        exclude: ['/node_modules/', '/spec/'],\r\n      },\r\n    ],\r\n  },\r\n  resolve: {\r\n    extensions: [ '.ts', '.js' ],\r\n  },\r\n  output: {\r\n    filename: '[name].js',\r\n    path: path.resolve(__dirname, 'dist'),\r\n    library: 'GridStack',\r\n    libraryExport: 'GridStack',\r\n    libraryTarget: 'umd', // var|assign|this|window|self|global|commonjs|commonjs2|commonjs-module|amd|amd-require|umd|umd2|jsonp|system\r\n  }\r\n};\r\n"
  }
]