* docs(events): JSDoc improvments
* fix(filter): Introduce enqueueEvent; don't reorder in filter
Remove the broken BlockChange event reordering code from filter.
Instead, do necessary event reordering (correctly, this time)
in a new enqueueEvent function used by fireInternal.
* chore(events): Deprecate forward parameter of filter
Since we don't filter in undo any more, and filtering in reverse
order causes problems, prepare to remove this opportunity for
error.
* fix(events): Only merge adjacent events
Simplify filter by having it consider only adjacent events in the
queue for merging.
Previously any events in the queue could potentially be merged if
they were of suitable (typically identical) .type, even if other
events had occurred between them (with the sole exception of
BlockMove events, which would only be merged with adjacent
events). This could potentially result in replay failures during
undo/redo/mirroring, though it is unknown whether any such
problems occurred in practice.
* refactor(events): Tweaks
- Use for…of loop where appropriate.
- Make filter reason-merging code more concise.
- Use arrow functions when calling Array.prototype.filter.
* chore(events): Fix typos for PR #8539.
* fix: Detect if deleting shadow block affects selection highlight
* Use contains instead of descendsFrom for html consistency.
* Added tests.
* Removing and manually inlining new contains function.
* refactor(events): Use "export ... from" where applicable
* refactor(events): Introduce EventType enum
Introduce an enum for the event .type values. We can't actually
use it as the type of the .type property on Abstract events,
because we want to allow developers to add their own custom
event types inheriting from this type, but at least this way we
can be reasonably sure that all of our own event subclasses have
distinct .type values—plus consistent use of enum syntax
(EventType.TYPE_NAME) is probably good for readability overall.
Put it in a separate module from the rest of events/utils.ts
because it would be helpful if event utils could use
event instanceof SomeEventType
for type narrowing but but at the moment most events are in
modules that depend on events/utils.ts for their .type
constant, and although circular ESM dependencies should work
in principle there are various restrictions and this
particular circularity causes issues at the moment.
A few of the event classes also depend on utils.ts for fire()
or other functions, which will be harder to deal with, but at
least this commit is win in terms of reducing the complexity
of our dependencies, making most of the Abstract event subclass
module dependent on type.ts, which has no imports, rather than
on utils.ts which has multiple imports.
* chore(deps): Add pretter-plugin-organize-imports
* chore: Remove insignificant blank lines in import sections
Since prettier-plugin-organize-imports sorts imports within
sections separated by blank lines, but preserves the section
divisions, remove any blank lines that are not dividing imports
into meaningful sections.
Do not remove blank lines separating side-effect-only imports
from main imports.
* chore: Remove unneded eslint-disable directives
* chore: Organise imports
* chore(deps): Bump chai from 4.3.10 to 5.1.1
Bumps [chai](https://github.com/chaijs/chai) from 4.3.10 to 5.1.1.
- [Release notes](https://github.com/chaijs/chai/releases)
- [Changelog](https://github.com/chaijs/chai/blob/main/History.md)
- [Commits](https://github.com/chaijs/chai/compare/v4.3.10...v5.1.1)
---
updated-dependencies:
- dependency-name: chai
dependency-type: direct:development
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* fix(tests): Migrate all usage of chai to ESM (#8216)
* fix(tests): Migrate node tests from CJS to ESM
This allows us to import (rather than require) chai, fixing failures
caused by that package dropping suppport for CJS in chai v5.0.0.
* fix(tests): Have mocha tests directly import chai
Previously they relied on obtaining it from the global scope, but it's
better if imports are explicit.
* fix(tests): Remove broken load of chai as script
Chai v5.0.0 no longer supports being loaded as a script, so this did
nothing but emit an syntax error message on the console.
* fix(tests): Migrate browser tests from CJS to ESM
This allows us to import (rather than require) chai, fixing failures
caused by chai no longer supporting CJS.
* chore(tests): format
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
* feat: allow prompt to take in additional params
* feat: allow confirm tot ake in extra args
* feat: allow alert dialog to take in extra parameters
* chore: add tests for dialog methods
* feat: Invalid Blocks
* Rename the new json property from invalid to invalidReasons.
* Merged isValid into isEnabled.
* Minor fixes.
* More minor fixes.
* Reverting some stuff that didn't need to change.
* Addressing PR feedback.
* Update the BlockInfo interface to match State.
* Make BlockChange.disabledReason private.
* chore: switch events to use new comment class
* fix: switch create and delete events to use JSON
* work on getting new comments to fire events
* chore: fixup tests
* chore: rename workspace comment test to comment view test
* chore: add tests for firing events
* chore: remove TODO
* fix: have XML save and load new comment classes
* chore: fix imports to resolve circular dependencies
* chore: add round-trip tests
* chore: skip failing test
* fixup: PR comments
* chore: delete mocha tests for angle field
* feat! : delete angle field
* chore(tests): delete colour tests from generator tests and golden files
* chore: delete colour blocks and associated generators
* chore: remove colour blocks from playgrounds
* chore: delete mocha tests for colour fields
* chore: fix incorrect comment
* chore: delete colour field from core
* chore: delete multiline input tests from generators tests and golden files
* chore: delete multiline text block and associated generators
* chore: remove multiline text block from playgrounds
* chore: delete mocha tests for multiline input field
* chore: delete multiline input field from core
* fix: add basic autoclose toggling support
* fix: drag areas being incorrect
* fix: blocks getting bumped around when dragged into flyout area
* fix: respect always-open flyouts attached to toolboxes
* fix: flyout not hiding on ws click
* fix: have all flyouts filter for capacity
* chore: cleanup
* fix: view metrics not respecting flyout
* chore: fix change detectors
* fix: trashcan not firing close event on click
* add saveIds param and logic to save correctly
* remove whitespace
* add saveIds to recursive calls
* run format
* change name from addIds to saveIds
* add saveIds test
* change blockId on false saveIds to undefined
* chore: delete dead code
* chore: moves location updating into the block
* chore: change dragging to use update component locations
* fix: field widgets not being moved when blocks are editted
* chore: remove unnecessary resizeEditor_ calls
* chore: format
* chore: fix build
* fix: tests
* chore: PR comments
* chore: format