Commit Graph

633 Commits

Author SHA1 Message Date
Christopher Allen
724828f689 refactor: Use arrow functions when calling Array.prototype.filter (#8557) 2024-08-30 17:23:23 +01:00
Christopher Allen
a7afda8343 fix(events): Simplify filter function, add new enqueueEvent function (#8539)
* 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.
2024-08-29 17:41:54 +01:00
John Nesky
095f29e274 fix: Detect if deleting shadow block affects selection highlight (#8533)
* 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.
2024-08-26 12:22:37 -07:00
Christopher Allen
7ccdcc5cef refactor(events): introduce EventType enum in separate module (#8530)
* 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.
2024-08-20 08:36:33 +01:00
Christopher Allen
ce22f42868 chore: Organise imports (#8527)
* 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
2024-08-15 03:16:14 +01:00
John Nesky
40c6d9c490 fix: Enable blocks if user can't manually enable them. (#8354)
* fix: Enable blocks if user can't manually enable them.

* Only change the affected test method.
2024-07-22 09:21:51 -07:00
John Nesky
9a0619aa2a fix: Drag and Resize events for workspace comments (#8217)
* feat: Added a comment_drag event.

* Add workspace comment resize events.

* Addressing PR feedback.

* Fixed chai imports in new test files.

* Addressing more PR feedback.
2024-06-26 12:16:56 -07:00
dependabot[bot]
bfb5b1dd49 chore(deps): Bump chai from 4.3.10 to 5.1.1 (#8092)
* 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>
2024-06-17 16:48:21 +01:00
Mark Friedman
5881ce32c1 fix: change which element keydown is bound to from document to injection div (#8188)
* Change which element keydown is bound to

* Modify keydown tests

* Use browserEvents.conditionalBind()

* Remove commented out code.
2024-05-31 23:19:46 +01:00
Beka Westberg
69db8a63d6 fix: comment size not respecting collapsed-ness (#8136)
* fix: comment size not respecting collapsed-ness

* chore: fix tests the only way I know how, by adding explicit clock ticks
2024-05-17 13:23:13 -07:00
Maribeth Moffatt
0255c580f7 Merge branch 'develop' into merge-v11 2024-05-13 11:20:39 -07:00
Maribeth Bottorff
28ac0c4473 fix: improve types in FieldRegistry (#8062)
* fix: improve types in FieldRegistry

* chore: tsdoc
2024-05-10 14:14:50 -07:00
Beka Westberg
c704d5a887 revert: "feat: allow the dialog methods to take in extra parameters (#8084)" (#8085)
This reverts commit 278006b5f8.
2024-05-10 11:12:15 -07:00
Beka Westberg
278006b5f8 feat: allow the dialog methods to take in extra parameters (#8084)
* 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
2024-05-08 10:10:09 -07:00
John Nesky
171befa746 fix!: Only fire intermediate events when editing input with invalid text. (#8054)
* fix: Fire intermediate events only when editing text input.

* Prefix unused arg with underscore.

* Fix tests.
2024-05-02 18:57:57 -07:00
John Nesky
cee7f916bb feat!: Invalid Blocks (#7958)
* 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.
2024-04-17 19:47:51 -07:00
Beka Westberg
7d8f88a4f1 chore: delete old comments (#8038)
* chore!: delete old comment classes and references

* chore: PR comments
2024-04-17 14:33:36 -07:00
Beka Westberg
fd177358ea feat: comment collapse event (#7949)
* feat: define comment collapse event

* feat: add firing collapse events

* chore: add round-trip test

* chore: add tests for firing collapse events

* chore: format
2024-04-04 15:48:34 -07:00
Beka Westberg
ed403d0b77 feat!: change gestures to look at selected when dragging (#7991)
* feat: change gestures to look at selected when dragging

* chore: fix tests

* chore: format

* chore: PR comments
2024-04-04 08:52:43 -07:00
Beka Westberg
e75a4fb1d3 fix: comment move and change events (#7947)
* fix: comment move event

* feat: add support for a drag reason

* fix: comment change events

* chore: add tests for move and change events
2024-04-03 12:58:04 -07:00
Maribeth Bottorff
b7cdeffccd chore: merge develop into rc/v11 2024-04-01 14:57:19 -07:00
Beka Westberg
2fa6f5b954 fix: comment icon interface re serialization (#7964)
* fix: comment icon interface re serialization

* chore: fix test
2024-04-01 14:34:48 -07:00
Beka Westberg
63eb4ecb2a fix: comment create and delete events (#7945)
* 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
2024-04-01 21:33:50 +00:00
Maribeth Bottorff
6767717d0b feat: allow duplicate registry values (#7988) 2024-04-01 14:13:25 -07:00
Beka Westberg
5462b21b15 fix: comment have XML save and load new workspace comments classes (#7931)
* 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
2024-03-20 16:25:41 -07:00
Beka Westberg
407ff44e18 feat: add JSON serialization for workspace comments (#7927)
* feat: basic comment serializer

* bad: temporarily jam new comment classes into array

* chore: implement serializer

* chore: add serialization tests

* chore: JSDoc

* chore: unonly tests
2024-03-20 12:40:27 -07:00
Christopher Allen
10ffcb706d release: Merge branch 'develop' into rc/v11.0.0 2024-03-18 19:57:04 +00:00
Beka Westberg
8821c83cc9 feat: allow overriding comment icons (#7937)
* feat: add comment icon interface

* feat: have blocks construct comment icons from registry

* chore: add tests for setCommentText

* fix: typeguard
2024-03-15 18:20:08 +00:00
Neil Fraser
0ecbcde9fc chore: Use .includes and .startsWith, not .indexOf (#7936)
Easier to read than the diverse collection of `=== 0` and `!== -1` and `> -1` tests.
2024-03-15 00:03:55 +01:00
Rachel Fenichel
67c3aae76c feat!: delete angle, colour, and multiline input fields and blocks (#7932)
* 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
2024-03-13 13:28:26 -07:00
Beka Westberg
a5126d1176 fix!: have disposing be true from start of dispose (#7891) 2024-03-13 09:23:11 -07:00
Beka Westberg
fc4228ce03 feat: add comment view (for workspace comments, and block comments for partners) (#7914)
* feat: add basic comment view

* feat: add icons to comment

* chore: add text area to comment view

* feat: add getting size

* feat: add collapsing comment view

* feat: add setting editability

* feat: add location and text hooks.

* feat: add changing the size

* feat: resizing

* feat: add collapsing

* feat: add disposing

* feat: add cursors

* feat: add moving to the front

* chore: split construction into subprocedures

* chore: split resizing into subprocedures

* feat: handle RTL

* chore: add doc comments throughout file

* chore: reduce css specificity where possible

* chore: format

* feat: add remove change listener methods

* chore: add tests for listeners

* feat: add disposing accessors

* chore: add coordinate system notes

* chore: add issues to TODOs where possible

* chore: remove suite.only
2024-03-11 12:12:35 -07:00
Beka Westberg
abe4cf98f2 chore: fix v11 branch build (#7836)
* chore: fix render management lint

* fix: build
2024-02-07 09:30:44 -08:00
Beka Westberg
b2b12f42fd merge develop into rc/v11.0.0 2024-02-02 22:14:46 +00:00
Beka Westberg
5db9b5bf11 fix: block initialization (#7777)
* fix: reorganize initialization

* chore: fix failing tests

* fix: tests

* chore: format

* chore: remove console trace
2024-01-23 08:48:08 -08:00
Beka Westberg
8c5f32b2f9 fix: bump neighbours performance regression (#7748)
* fix: move bumping neighbours to the end of rendering

* chore: remove scheduleSnapAndBump

* chore: remove references to bumpNeighbours

* chore: work on fixing tests

* fix: bump neighbours event grouping

* chore: format

* chore: readd deprecation import

* fix: move event ordering

* chore: undeprecate bumpNeighbours

* fix: bumping during drag due to insertion markers

* chore: tests

* chore: PR feedback

* chore: docs

* chore: typo
2024-01-23 08:48:08 -08:00
Beka Westberg
43f6df92a3 fix!: rendered meaning (#7747)
* fix: make rendered strictly for differentiating blocksvgs

* chore: fix references to rendered

* chore: fix tests

* chore: delete TODO
2024-01-23 08:48:08 -08:00
Beka Westberg
b1ef6ae601 feat!: modify icons to use the rendering queue (#7743) 2024-01-23 08:48:08 -08:00
Beka Westberg
0ad0adfb75 feat!: add serialization hooks to procedure models (#7740)
* feat!: add serialization hooks to procedure models

* chore: fix tests

* chore: remove internal functions

* fix: add state interfaces back
2024-01-23 08:48:08 -08:00
Beka Westberg
5ade042e95 fix: triggering flyout show from field render causing infinite loop (#7784)
* fix: triggering flyout show from field render causing infinite loop

* chore: add tests for triggering queued renders
2024-01-12 13:43:55 -08:00
Blake Thomas Williams
3e75f4f6f6 fix: updated mocha tests to display error messages (#7706)
* fix: updated mocha tests to display error messages

* fix: replaced double quotes with single quotes
2023-12-08 13:56:28 -08:00
truongductri01
96a354b46b feat: added intermediate event change (#7671)
* feat: added intermediate event change

* fix: update prettier format for the code

* fix: update comment style

* fix: update test statements
2023-12-04 13:10:09 -08:00
Maribeth Bottorff
e6de8581dd fix: disabled render status after serialization (#7650)
* fix: disabled render status after serialization

* chore: format

* chore: better names

* chore: format
2023-11-17 23:58:35 +00:00
Beka Westberg
02cd1c6a1b fix: blocks being dragged behind toolbox (#7619)
* fix: add layer manager to fix dragging

* chore: fix block animations

* chore: add tests

* chore: format
2023-11-08 15:25:45 -08:00
Beka Westberg
d8eb7b56bb fix: make autoclose toggleable for flyouts (#7634)
* 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
2023-11-07 13:12:21 -08:00
Beka Westberg
0ad57f4fd3 fix: shadows in insertion markers being displayed as shadows (#7609)
* fix: shadows in insertion markers being displayed as shadows

* chore: add unit tests

* chore: remove only
2023-11-03 11:19:30 -07:00
Trey Pisano
73841995ec fix: flyout id is different than first placed block (#7618)
* 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
2023-11-01 08:52:27 -07:00
Beka Westberg
7d2c307fed fix: widget positioning (#7507)
* 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
2023-10-26 09:47:39 -07:00
Rachel Fenichel
ed043e7228 Merge pull request #7500 from rachel-fenichel/update_webdriverio
chore(deps): update webdriverio to 8.16 and remove selenium-standalone
2023-09-19 14:19:04 -07:00
Beka Westberg
32c9daf885 fix: bad JSON state leaving events disabled (#7501)
* fix: broken JSON state stopping event firing

* chore: add unit test for events not breaking
2023-09-19 05:17:51 -07:00