Skip to content

Commit

Permalink
feat: state refactor (#111)
Browse files Browse the repository at this point in the history
BREAKING CHANGES:

- The type `JSONPath` is changed from `Array<string | number>` to `Array<string>`
- Some TypeScript types now come from `immutable-json-patch`

All changes:

- Refactor state from relying on a nested structure and Symbols into a solution that is lazy
  and uses a flat map with pointers. The new state is easier to understand and maintain.
- Create and use helper functions like `createValueSelection` to create selections, and use
  type guards like `isValueSelection` everywhere to simplify the code.
- Refactor `JSONPath` from having numeric indexes to having them as string
  (better compatible with `JSONPointer`, and less error-prone).
- Use more TypeScript types from `immutable-json-patch`
- Refactor and simplify the dragging logic
- Fix issues related to selection being updated after patch instead of in one go
- Refactor more code to TypeScript
- Add unit tests
- Performance is comparable to what it was
  • Loading branch information
josdejong committed Jul 6, 2022
1 parent c85a324 commit a58b4c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changelog


All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.3.60](https://github.com/josdejong/svelte-jsoneditor/compare/v0.3.59...v0.3.60) (2022-06-09)
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"lint:eslint": "eslint --cache --ignore-path .gitignore .",
"format": "prettier --write --plugin-search-dir=. .",
"prepare": "husky install && cd tools && node generateDiffSequenceEsm.js && cd ..",
"release": "npm run lint && npm test && standard-version && npm run package && git push && git push --tag && npm publish package/"
"release": "npm run lint && npm test && standard-version && npm run package && git push && git push --tag && npm publish package/",
"dry-run": "standard-version --dry-run"
},
"dependencies": {
"@codemirror/commands": "^6.0.1",
Expand Down

0 comments on commit a58b4c3

Please sign in to comment.