-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add JSON serialization - goog version #5487
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 tasks
BeksOmega
force-pushed
the
project-cereal-goog
branch
from
September 17, 2021 20:32
5b588cd
to
0996880
Compare
* Setup basic architecture for tests * Attribute tests * Easy field tests added * Work on tests * Work on tests * Work on tests * Add mutation tests * Fixup ID tests * Add more mutator tests * Fixup lint and typos * Uncomment tests * Use test helpers * Small PR comments * Use test helpers for setup and teardown * Add TODOs and fixup types * Fix types * Actually fix types
* Add JSON serialiation hooks for fields * Add checking for JSON hooks * Fix other checks and move checks to function * Remove error for both serialization hooks being defined * Fixup comments and errors * Add tests * Add json hooks to block properties * Cleanup * Rip out fragile backwards compatibility
* Add basic attribute tests * Add basic block serialization * Add more attribute tests * Change save to use options dictionary * Add obeying save options * Add test for data attribute * Add saving data tag * Move to ES6 syntax * Fixup move to es6 syntax * Declare module * Format and lint * Add docs * Add returning null on insertion markers * Fixup for move to module * Switch to other function declarations * Cleanup for finalized style * Fix lint and types * Export State def * Switch disabled=true to enabled=false
* Add tests for saving extra state * Add serializing extra state * Fix backwards compatibility * Switch to other function declarations * Handle null returns from hooks * Remove backwards compatibility * Remove XML require, and fix type * Fix JSDoc formatting
* Add tests for field serialization * Add field serialization * Fixup types and tests
* Upgrade field angle to use new serialization * Upgrade field checkbox to use new serialization * Upgrade field colour to use new serialization * Upgrade field dropdown to use new serialization * Upgrade serializable label field to use new serialization * Upgrade field multiline input to use new serialization * Upgrade field number to use new serialization * Upgrade field text input to use new serialization * Upgrade variable field to use new serialization * Fix type casts * Feedback from PR * Switch to use getValue()
* Add tests for serializing connected blocks * Add serialization of child blocks * Add tests for not serializing children * Add options for not serializing children * Fix types * Change addNextBlocks to default to true * Cleanup * Fix types
* Add variable serialization tests * Fix requires for new file * Add serialization and deserialization of variables * Remove only in tests * Cleanup
…#5132) * Add top-level serialization API * Add using JSO system in serializer tests * Make compiler happy
* Fixup tests * Add deserialization of blocks * Cleanup * PR commnts
* Change playground to use JSO system * Add tests for initialization and events * Add initialization of blocks * PR Comments
* Add parameter for recording undo. This sets up the most common default behavior, but also makes it clear to people that it is happening, because it might not be expected. * Add grouping of events * Add text width caching * Add disabling workspace resizing * Add performance optimizations * Respect nulls from blocks.save * Cleanup from rebase * PR Comments * Cleanup from rebase
* Respect nulls from blocks.save * Upgrade list blocks to use JSO serialization * Upgrade logic blocks to use JSO serialization * Upgrade math blocks to use JSO serialization * Upgrade text blocks to use JSO serialization * Upgrade procedure blocks to use JSO serialization * Add more mutator tests * Fix firing enabled events * PR Comments
* Add exception definitions * Add tests for throwing errors during deserialization * Add actually throwing exceptions * Cleanup * Cleanup * Fix tests * fix: PR Comments
* Add tests for (de)seralizing icons * Add logic for (de)serializing icons * fix: add docs for saveIcons * fix: add timeout for setting comment visible
* Move existing tests into new suite * Add tests for setShadowState * Add assertions for serialization * Unskip serialization tests * Add logic to handle shadows in both systems * Uncomment tests * fix: add access modifiers to new comment funcs * fix: fixup types * fix: remove addNextBlocks = true * feat: add real child of shadow errors * fix: types
* fix: add tests for fixing change events * fix: change events and insertion markers * fix: build: * fix: remove duplicate code * fix: requires
* Reformat registry tests * Add tests for plugin hooks * Add plugin hooks for serialization * Switch PluginSerializer to IPluginSerializer * fix: types * fix: PR comments * fix: tests * cleanup: formatting * fix: types * feat: add respecting case in registry * feat: add separate registry for serializers * fix: rename serialiation registry alias * fix: move serializer interface into interface dir
* fix: remove some attributes from the JSO system Remove the deletable, movable, and editable attributes. Normally this would be a breaking change, but because this isn't released yet it's just a patch. * fixup: serializer tests
* fix: add throwing errors for bad shadows * tests: add tests for setShadowDom
* fix: not being able to specifying variable names in toolbox * fix: id -> ID
* feat: add recycling to core * feat: add support for json block definitions in flyout * tests: reorganize tests * tests: add tests for generating contents * Fixup reycling * tests: add tests for recycling * fix: types * fix: lint * fix: PR comments * fix: creating blocks from flyout * test: add test block to playground * fix: types * feat: add support for enabled
* fix: serializing shadows * tests: add tests for serializing editted shadows
* fix: remove duplicate serialization hook implementations * feat: add backwards compatibility to field serialization * feat: add support for serializing old mutator hooks * fix: build * fix: refactor field changes into helpers * fix: typo * fix: removing xmlns * tests: add tests for serialization and deserialization of mutator hooks * fix: switch to early returns
* fix: copy paste w/ json system * fix: pr comments
* fix: positioning of flyout blocks * fix: move flyout to JSON system * cleanup: remove test code from playground
* fix: create and delete events with JSON serialization * fix: trashcan with JSON serialization * fix: build * fix: tests * fix: PR comments * fix: types * fix: tests
* fix: update code demo to include JSON * fix: do property renames * fix: change XML to place holder * fix: PR comments
* fix: dragging variables from flyout * fix: rename positionBlock_ to positionNewBlock_ * fix: type * fix: try alternative method for handling variables in flyout
* fix: make exception constructors package * fix: rename blocks.load to blocks.append * fix: inline docs * fix: consistency in block serialization * fix: remove unexported functions * fix: interface requires * fix: tag TODO with issue number
alschmiedt
force-pushed
the
project-cereal-goog
branch
from
September 20, 2021 17:55
0996880
to
1e8919b
Compare
LGTM! |
alschmiedt
approved these changes
Sep 20, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The basics
The details
Resolves
Final part of Project Cereal!
Proposed Changes
Adds a new JSON serialization system to Blockly.
Behavior Before Change
No JSON serialization =(
Behavior After Change
Yes JSON serialization =)
Reason for Changes
JSON serialization is more compressible, writable, and extensible.
Test Coverage
Added 580+ unit tests, covering all the new stuff. Plus a bunch of manual testing, which can be found in the internal doc.
Tested on:
Documentation
Changes to the dev site are already in :D They just need to be unfrozen.
I've also updated all the codelabs in this PR.
Additional Information
This should be Rebase and Merged, not squash & merged, nor merge committed.
We want to keep all that yummy git history.