Commit Graph

4123 Commits

Author SHA1 Message Date
Christopher Allen
f9c865b1b3 refactor(generators)!: CodeGenerator per-block-type generator function dictionary (#7150)
* feat(generators): Add block generator function dictionary

  Add a dictionary of block generator functions, provisionally
  called .forBlock.  Look up generator functions there first, but
  fall back to looking up on 'this' (with deprecation notice)
  for backwards compatibility.

  Also tweak error message generation to use template literal.

* refactor(generators)!: Update generator definitions to use dictionary

* fix(tests): Have blockToCodeTest clean up after itself

  Have the blockToCodeTest helper function delete the block generator
  functions it adds to generator once the test is done.

* refactor(tests): Use generator dictionary in insertion marker test

  The use of generators in insertion_marker_test.js was overlooked
  in the earlier commit making such updates, and some test here
  were failing due to lack of cleanup in
  cleanup in the generator_test.js.

BREAKING CHANGE: this PR moves the generator functions we provide
from their previous location directly on the CodeGenerator instances
to the new .forBlock dictionary on each instance. This does not oblige
external developers to do the same for their custom generators, but
they will need to update any code that references the generator
functions we provide (in generators/*/*, i.e. on javascriptGenerator,
dartGenerator etc.) e.g. to replace the implementation or reuse the
implementation for a different block type.
2023-06-13 20:41:14 +01:00
Evan W. Patton
f37380969a fix: Allow for unattached elements during inject call (#7149)
Change-Id: I616cb30b8a3292b3be9f58536d7bfb9444e529d4
2023-06-13 09:30:45 -07:00
Beka Westberg
2f74ce822f fix!: refactor mutator icon (#7115)
* feat: add basic mutator icon

* feat: add actual mutation behavior to icon

* chore: add bumping blocks back into the bubble

* fix: add updating block styles

* feat: add static methods to mutator icon

* chore: delete old mutator code

* fix: use the new mutator icon

* chore: docs and format

* chore: my own comments

* chore: first pass at PR comments

* chore: make type strings internal

* chore: add todo

* chore: format

* chore: move properties to module level

* chore: fix using in demos

* chore: move Mutator to icons.MutatorIcon

* chore: move reconnect to connection

* chore: move findParentWs to workspace

* chore: properly override and call super

* chore: remove bubbleIsVisible check

* chore: change imports to import type

* chore: use elvis operator

* chore: update renamings

* chore: reduce changes to js block files
2023-06-02 12:18:41 -07:00
Beka Westberg
50d9474db5 fix!: refactor comment icon (#7128)
* fix: add basic comment icon

* fix: add using comment icon

* chore: delete old comment icon

* chore: add docs to the comment icon

* chore: move Comment to icons.CommentIcon

* chore: mode properties to module level

* chore: properly override and call super

* chore: remove .comment and .commentIcon_

* chore: cleanup test

* chore: deprecate getCommentIcon and getCommentText

* chore: change imports to import type

* chore: refactor code for paren peace

* chore: fix lint and make it error

* chore: remove change to block JS file

* chore: fix css

* chore: add renamings

* chore: format
2023-06-02 09:53:05 -07:00
Beka Westberg
f4e378d096 fix!: refactor warning icon (#7112)
* feat: add basic warning icon

* feat: work on actually using the warning icon

* chore: add docs

* chore: delete old warning icon

* chore: fix build

* chore: my own comments

* chore: move Warning to icons.WarningIcon

* chore: move properties to the module level

* chore: properly override and call super

* chore: properly use optional chaining

* chore: fixup comment typo

* chore: change imports to import type

* chore: reduces changes in block js files

* chore: add renaming
2023-06-02 09:34:34 -07:00
Beka Westberg
91be84ab7c fix!: move destroy earlier in the lifcycle (#7117) 2023-06-01 05:25:31 -07:00
Beka Westberg
473a5ab7b1 fix: have inputs construct connections (#7116)
* fix: have inputs construct connections

* chore: fix build hopefully

* fix: PR comments
2023-05-24 13:50:06 -07:00
Beka Westberg
42b8c6e3ab fix: return annotations (#7118)
* chore: remove suppress annotations

* chore: remove fileoverview annotation

* chore: remove other unused annotations

* chore: change return to returns

* chore: enable tag linting
2023-05-24 13:01:33 -07:00
Beka Westberg
b5db021eed feat: text input bubble (#7089)
* feat: add basic text bubble

* feat: add resizing the text input bubble

* chore: add docs

* chore: mouse -> pointer

* chore: fixup from PR comments
2023-05-24 13:01:03 -07:00
Beka Westberg
5b2529a25d fix: updating icon locations (#7110)
* fix: updating icon locations

* fix: updating icon locations after appending

* fix: updating icon locations in deserialization
2023-05-24 12:46:06 -07:00
Beka Westberg
6e3d052100 fix: collapsing blocks with children with icons (#7111)
* fix: collapsing blocks with icons

* chore: add tests for hiding icons of collapsed children
2023-05-22 13:53:34 -07:00
Beka Westberg
d90d00570f fix: gestures handling icons (#7101)
* fix: add handling icon clicks to the gesture system

* fix: error message
2023-05-22 13:10:42 -07:00
Beka Westberg
4dc2869778 fix: work on calling icon hooks (#7100)
* fix: work on calling icon hooks

* chore: PR comments

* chore: format
2023-05-19 15:36:44 -07:00
Beka Westberg
83c6c73817 feat: mini workspace bubble (#7096)
* feat: add properly sizing mini workspace bubble

* chore: add properly handling workspace options

* fix: various sizing and option bugs

* fix: code related to dragging

* fix: remove adding flyout change listener

* chore: add docs

* fix: build

* fix: PR comments'

* chore: PR comments
2023-05-19 15:36:34 -07:00
Beka Westberg
e538a334b5 fix: bubbles not being dragged (#7088) 2023-05-18 10:03:09 -07:00
Michal Grňo
d3939f7a48 Make props of ConnectionState optional (#7093) 2023-05-18 09:00:12 -07:00
Beka Westberg
f2221652d2 feat: add registering and serializing icons (#7063)
* feat: add registry for icons

* feat: add serialization of custom icons

* feat: add deserialization of custom icons

* chore: fixup deserialization

* chore: export icons registry

* chore: add tests for serialization and deserialization

* chore: move mocks and helpers to the top level

* chore: fix doc error

* chore: remove accidental only
2023-05-15 09:03:04 -07:00
Beka Westberg
da6d059fde feat: implements text bubble class (#7080) 2023-05-12 15:43:38 -07:00
Beka Westberg
794c045691 feat: bubble ownership (#7071)
* chore: rename bubble to old bubble

* chore: work on new bubble class

* chore: basic bubble implementation

* chore: add positioning code

* chore: add positioning code

* chore: more layouting code

* chore: implement IBubble thingies in new bubble

* chore: add docs

* chore: PR comments

* chore: fixup positioning bugs

* chore: fix lint

* chore: change height and width to get methods
2023-05-12 16:28:09 +00:00
Beka Westberg
455c1957b8 fix!: re-remove block and workspace drag surfaces (#7070)
* refactor: Remove BlockDragSurface.

* refactor: Remove WorkspaceDragSurfaceSvg.

* chore: Remove drag surface-related CSS.

* chore: Removed unused variable in block_dragger.ts.

* chore: Remove references to drag surfaces in comments.

* refactor: Only track icons with visible bubbles for position updates during a drag.

* fix: Remove rendundant condition.

* chore: fixup parameter from rebase

---------

Co-authored-by: Aaron Dodson <adodson@google.com>
2023-05-11 16:51:46 -07:00
Rachel Fenichel
b29a5caae6 chore: delete debug renderer (#7078) 2023-05-11 16:09:24 -07:00
Beka Westberg
8b0c40bb1b feat: add implementations for adding, removing, and getting icons (#7059)
* feat: add implementations for adding, removing, and getting icons

* chore: fix tests

* chore: switch order of adding icons

* chore: create duplicate icon error

* chore: un-only test
2023-05-11 15:48:01 -07:00
Rachel Fenichel
de904ab128 chore: remove deprecated functionality for v10 (#7077)
* chore: remove deprecated functionality in events files

* chore: remove deprecated items in renderers

* chore: remove deprecated items in core

* chore: remove mixin deprecation

* chore: fix tests after removing deprecations
2023-05-11 14:30:54 -07:00
Evan W. Patton
bef5526f1c fix: Filter undo stack after firing events (#7069)
Change-Id: I21eb3dfaaf5089d373b0f7e810da657c9b541b8b
2023-05-11 14:27:09 -07:00
Maribeth Bottorff
88ff901a72 chore: use prettier instead of clang-format (#7014)
* chore: add and configure prettier

* chore: remove clang-format

* chore: remove clang-format config

* chore: lint additional ts files

* chore: fix lint errors in blocks

* chore: add prettier-ignore where needed

* chore: ignore js blocks when formatting

* chore: fix playground html syntax

* chore: fix yaml spacing from merge

* chore: convert text blocks to use arrow functions

* chore: format everything with prettier

* chore: fix lint unused imports in blocks
2023-05-10 16:01:39 -07:00
Beka Westberg
af991f5e1b fix: switch most remaining render calls to queueRender (#7024)
* chore: remove render call from procedure blocks

* chore: have workspace queue renders when unhiding

* chore: remove forced rendering from flyouts

* chore: change mutators to use queueing

* chore: change shadows to use queueing

* chore: add comments about icon rendering
2023-05-09 16:57:11 -07:00
Beka Westberg
39cdd8a67a feat: add abstract icon class (#7060)
* chore: rename icon to old icon

* feat: add abstract icon class

* chore: format

* chore: move icon class to icons directory

* chore: switch imports to import type
2023-05-09 23:42:58 +00:00
Beka Westberg
07db0c27d1 feat: add IIcon interface, and related interfaces (#7054)
* feat: add IIcon interface

* feat: add ISerializable interface

* feat: add IHasBubble interface

* feat: add type guards for icon interfaces

* chore: PR comments
2023-05-09 10:13:44 -07:00
Beka Westberg
3a9a9bd24e feat: break input types into separate classes (#7019)
* chore: move input and input types into new directory

* feat: define and export new input types

* feat: modify blocks to construct individual inputs

* chore: transition code to use actual type checks

* chore: fixup input type type

* chore: format

* chore: fixup PR comments

* chore: fix build
2023-05-04 08:50:45 -07:00
Markus Bordihn
b996372994 Update category.ts to produce valid "aria-level" attributes to fix #7027 (#7033) 2023-05-03 10:39:31 -07:00
Rachel Fenichel
fea91af90e chore: remove private underscores in gesture.ts (#7021)
* chore: remove private underscores in gesture.ts

* chore: format

* chore: remove a stale todo
2023-05-01 09:09:46 -07:00
Rachel Fenichel
08d57853be chore: remove private underscores in field_variable.ts (#7022)
* chore: remove private underscores in field_variable.ts

* chore: remove stale TODO
2023-04-27 10:05:53 -07:00
Neil Fraser
64aa3e7df4 feat: Add 'reason' field to move event (#6996)
* feat: Add 'reason' field to move event

There are many types of move.  This addition allows one to detect what the reason for each move is.

* Clang formatting.

And unsaved editor tabs.

* Change reason string to array.
2023-04-26 00:22:10 +02:00
Beka Westberg
139bc299a0 fix: icons not having their locations updated (#7012)
* fix: icons not having their locations updated

* chore: fix running headful tests in node
2023-04-24 15:36:13 -07:00
Rachel Fenichel
96ecfea857 refactor(blocks): Migrate blocks/variables.js and blocks/variables_dynamic.js to TypeScript (#7001)
* refactor: run js2ts on variables

* refactor: clean up conversion of variables blocks to typescript

* refactor: add types for custom context menu options

* refactor: run js2ts on blocks/variables_dynamic.js

* refactor: clean up types in variables_dynamic

* chore: respond to PR comments

* chore: format
2023-04-24 13:09:02 -07:00
Rachel Fenichel
705a35a2d2 chore: clean up some drawer code lint (#6994)
* chore: clean up some drawer code lint

* chore: remove hungarian notation
2023-04-24 10:38:32 -07:00
Maribeth Bottorff
bf8be1a4f9 fix: update applyColour documentation (#6998) 2023-04-24 10:23:16 -07:00
Beka Westberg
d726080eaa feat: add support for appending custom inputs (#6990)
* feat: add appendInput method

* feat: enable constructing inputs from the registry

* chore: reorganize into suites

* chore: add new input test + fixup existing

* chore: reorganize appending from registry

* chore: fix input types enum

* chore: fix tests
2023-04-21 15:58:42 -07:00
Beka Westberg
35276e9468 fix: insertion markers firing move events (#7005) 2023-04-21 12:49:02 -07:00
Maribeth Bottorff
467b6a2e79 fix: rtl field alignment (#6991) 2023-04-20 13:53:18 -07:00
Dima
acd046e4b3 fix: block_svg disable/enable ops lead to unsync state and render (#6989)
* fix: disable/enable block_svg downstream blocks

* fix: disable/enable block_svg improve
2023-04-19 15:11:21 +00:00
Beka Westberg
83e3dcac70 feat: add after queued renders promises to render management (#6981)
* feat: add promise to render queue system

* chore: update docs for variables

* chore: add export of render management

* chore: add tests for resolving render management promises

* fix: modify insertion marker manager to use render management promises

* chore: format

* chore: remove callback from afterQueuedRenders

* chore: don't store resolver

* chore: rename afterQueuedRenders -> finishQueuedRenders

* chore: fix tests
2023-04-18 17:02:33 -07:00
Beka Westberg
edc5843c4c fix: non-printable characters in XML (#6952)
* fix: non-printable characters in XMl

* fix: PR comments

* chore: format

* chore: move to module-level parser and serializer

* chore: reorganize textToDom

* chore: add dummy implementations of domParser and xmlSerializer

* chore: properly check classes before constructing

* chore: fix tests

* chore: PR comments

* chore: remove null char from tests

* chore: docs!
2023-04-17 16:05:09 -07:00
Neil Fraser
20f0c937cd chore: 'compareDocumentPosition' to 'contains' (#6982)
The 'compareDocumentPosition' call was inherited from Closure Library, in order to work with IE 8 and earlier.  Use the more modern 'contains' call instead.

This change was originally added here:
https://github.com/google/blockly/pull/1991

Remove the DOCUMENT_POSITION_CONTAINED_BY constant which is not a NodeType and should never have been part of that enum.

This change was originally added here:
https://github.com/google/blockly/pull/2736
2023-04-17 23:48:24 +02:00
Maribeth Bottorff
2bbb3aa1fc fix: do not hide all chaff when resizing (#6916) 2023-04-17 10:06:44 -07:00
Neil Fraser
2fa7280ce1 fix: Don't truncate text label fields. (#6979)
https://groups.google.com/g/blockly/c/S5b3iKB2Sos
2023-04-15 17:34:20 -07:00
Rachel Fenichel
c458d63018 chore: remove underscores from private properties and methods in some fields (#6977)
* chore: remove private underscores in field_checkbox

* chore: remove private underscores from field_dropdown

* chore: remove private underscores in field_image

* chore: remove private underscores in field_label

* chore: remove private underscores in field_number

* chore: format
2023-04-13 14:59:43 -07:00
Rachel Fenichel
5f8330e74e chore: remove underscores from private properties and methods in keyboard nav and rendering (#6975)
* chore: remove underscores in keyboard navigation

* chore: remove private underscores from renderers
2023-04-12 11:19:41 -07:00
Neil Fraser
8ade26148c Fix offset location of connection ripple (#6973)
Resolves issue #6972
2023-04-12 10:00:41 -07:00
Rachel Fenichel
85013f83b2 chore: remove underscores from private properties and methods in connections (#6961)
* chore: remove private underscores in connection and connection_db

* chore: remove private underscores in rendererd_connection
2023-04-11 10:06:17 -07:00